summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-07 08:37:39 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-07 08:37:39 -0700
commitd644ddcc643be8b30e70b7585a1d32c958e990a4 (patch)
treeeec14828d64e529e8b0236dfa0c7e2850e210c44 /source
parent54519ed70fbe154e196d04a8b62f6ea6aeded52a (diff)
Add some reflection support for SSBO and `tbuffer` declarations
These are mostly copy-pasted from the existing `cbuffer` support, so there might be details I'm missing.
Diffstat (limited to 'source')
-rw-r--r--source/slang/reflection.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp
index b27cc0696..d62da70c1 100644
--- a/source/slang/reflection.cpp
+++ b/source/slang/reflection.cpp
@@ -100,6 +100,14 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType)
{
return SLANG_TYPE_KIND_CONSTANT_BUFFER;
}
+ else if (type->As<TextureBufferType>())
+ {
+ return SLANG_TYPE_KIND_TEXTURE_BUFFER;
+ }
+ else if (type->As<GLSLShaderStorageBufferType>())
+ {
+ return SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER;
+ }
else if (auto samplerStateType = type->As<SamplerStateType>())
{
return SLANG_TYPE_KIND_SAMPLER_STATE;
@@ -1049,6 +1057,24 @@ static void emitReflectionTypeInfoJSON(
type->getElementType());
break;
+ case SLANG_TYPE_KIND_TEXTURE_BUFFER:
+ write(writer, "\"kind\": \"textureBuffer\"");
+ write(writer, ",\n");
+ write(writer, "\"elementType\": ");
+ emitReflectionTypeJSON(
+ writer,
+ type->getElementType());
+ break;
+
+ case SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER:
+ write(writer, "\"kind\": \"shaderStorageBuffer\"");
+ write(writer, ",\n");
+ write(writer, "\"elementType\": ");
+ emitReflectionTypeJSON(
+ writer,
+ type->getElementType());
+ break;
+
case SLANG_TYPE_KIND_SCALAR:
write(writer, "\"kind\": \"scalar\"");
write(writer, ",\n");
@@ -1184,6 +1210,23 @@ static void emitReflectionTypeLayoutInfoJSON(
typeLayout->getElementTypeLayout());
break;
+ case SLANG_TYPE_KIND_TEXTURE_BUFFER:
+ write(writer, "\"kind\": \"textureBuffer\"");
+ write(writer, ",\n");
+ write(writer, "\"elementType\": ");
+ emitReflectionTypeLayoutJSON(
+ writer,
+ typeLayout->getElementTypeLayout());
+ break;
+
+ case SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER:
+ write(writer, "\"kind\": \"shaderStorageBuffer\"");
+ write(writer, ",\n");
+ write(writer, "\"elementType\": ");
+ emitReflectionTypeLayoutJSON(
+ writer,
+ typeLayout->getElementTypeLayout());
+ break;
}
// TODO: emit size info for types