diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gfx/cpu/cpu-device.cpp | 5 | ||||
| -rw-r--r-- | tools/gfx/cuda/cuda-device.cpp | 3 | ||||
| -rw-r--r-- | tools/slang-reflection-test/slang-reflection-test-main.cpp | 45 |
3 files changed, 53 insertions, 0 deletions
diff --git a/tools/gfx/cpu/cpu-device.cpp b/tools/gfx/cpu/cpu-device.cpp index 0db2b0fa7..4b8595e82 100644 --- a/tools/gfx/cpu/cpu-device.cpp +++ b/tools/gfx/cpu/cpu-device.cpp @@ -45,6 +45,11 @@ namespace cpu m_info.timestampFrequency = 1000000000; } + // Can support pointers (or something akin to that) + { + m_features.add("has-ptr"); + } + return SLANG_OK; } diff --git a/tools/gfx/cuda/cuda-device.cpp b/tools/gfx/cuda/cuda-device.cpp index bbf50cc58..7f931afa1 100644 --- a/tools/gfx/cuda/cuda-device.cpp +++ b/tools/gfx/cuda/cuda-device.cpp @@ -185,6 +185,9 @@ SLANG_NO_THROW SlangResult SLANG_MCALL DeviceImpl::initialize(const Desc& desc) // CUDA has support for realtime clock m_features.add("realtime-clock"); + + // Allows use of a ptr like type + m_features.add("has-ptr"); } cudaDeviceProp deviceProps; diff --git a/tools/slang-reflection-test/slang-reflection-test-main.cpp b/tools/slang-reflection-test/slang-reflection-test-main.cpp index 94062cf2b..cd726eb59 100644 --- a/tools/slang-reflection-test/slang-reflection-test-main.cpp +++ b/tools/slang-reflection-test/slang-reflection-test-main.cpp @@ -292,6 +292,7 @@ static void emitReflectionVarBindingInfoJSON( CASE(MIXED, mixed); CASE(REGISTER_SPACE, registerSpace); CASE(GENERIC, generic); + #undef CASE default: @@ -769,6 +770,16 @@ static void emitReflectionTypeInfoJSON( emitReflectionTypeJSON(writer, arrayType->getElementType()); } break; + case slang::TypeReflection::Kind::Pointer: + { + auto pointerType = type; + writer.maybeComma(); + writer << "\"kind\": \"pointer\""; + writer.maybeComma(); + writer << "\"targetType\": "; + emitReflectionTypeJSON(writer, pointerType->getElementType()); + } + break; case slang::TypeReflection::Kind::Struct: { @@ -888,6 +899,40 @@ static void emitReflectionTypeLayoutInfoJSON( emitReflectionTypeInfoJSON(writer, typeLayout->getType()); break; + case slang::TypeReflection::Kind::Pointer: + { + auto valueTypeLayout = typeLayout->getElementTypeLayout(); + SLANG_ASSERT(valueTypeLayout); + + writer.maybeComma(); + writer << "\"kind\": \"pointer\""; + + writer.maybeComma(); + writer << "\"valueType\": "; + + auto typeName = valueTypeLayout->getType()->getName(); + + if (typeName && typeName[0]) + { + // TODO(JS): + // We can't emit the type layout, because the type could contain + // a pointer and we end up in a recursive loop. For now we output the typename. + writer.writeEscapedString(UnownedStringSlice(typeName)); + } + else + { + // TODO(JS): We will need to generate name that we will associate with this type + // as it doesn't seem to have one + writer.writeEscapedString(toSlice("unknown name!")); + SLANG_ASSERT(!"Doesn't have an associated name"); + } + + /* + emitReflectionTypeLayoutJSON( + writer, + valueTypeLayout); */ + } + break; case slang::TypeReflection::Kind::Array: { auto arrayTypeLayout = typeLayout; |
