summaryrefslogtreecommitdiffstats
path: root/source/slang/reflection.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-09 17:09:58 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-09 17:09:58 -0700
commit54364eb1aef3fc6aa87b144ba91ca0a77818e4a4 (patch)
tree09df600f9a221e5924451c25935f7a188976f48a /source/slang/reflection.cpp
parent68df74b58a56b0a1fb19b9ec4ff0282969cd6a12 (diff)
Some quick fixes to reflection API to try to help Falcor
- Expand most queries that handle `TextureType` to handle `TextureTypeBase`, in hopes that this covers most uses of `image*` types in Vulkan GLSL - Adopt the quick fix from Falcor to return read-write access for shader-storage-block types. Something more comprehensive is probably needed if people want to do queries on these, since constant buffers should really be included, then.
Diffstat (limited to 'source/slang/reflection.cpp')
-rw-r--r--source/slang/reflection.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp
index d62da70c1..eb27df398 100644
--- a/source/slang/reflection.cpp
+++ b/source/slang/reflection.cpp
@@ -112,7 +112,7 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType)
{
return SLANG_TYPE_KIND_SAMPLER_STATE;
}
- else if (auto textureType = type->As<TextureType>())
+ else if (auto textureType = type->As<TextureTypeBase>())
{
return SLANG_TYPE_KIND_RESOURCE;
}
@@ -326,7 +326,7 @@ SLANG_API SlangResourceShape spReflectionType_GetResourceShape(SlangReflectionTy
type = arrayType->BaseType.Ptr();
}
- if(auto textureType = type->As<TextureType>())
+ if(auto textureType = type->As<TextureTypeBase>())
{
return textureType->getShape();
}
@@ -363,7 +363,7 @@ SLANG_API SlangResourceAccess spReflectionType_GetResourceAccess(SlangReflection
type = arrayType->BaseType.Ptr();
}
- if(auto textureType = type->As<TextureType>())
+ if(auto textureType = type->As<TextureTypeBase>())
{
return textureType->getAccess();
}
@@ -385,6 +385,9 @@ SLANG_API SlangResourceAccess spReflectionType_GetResourceAccess(SlangReflection
CASE(HLSLByteAddressBufferType, SLANG_BYTE_ADDRESS_BUFFER, SLANG_RESOURCE_ACCESS_READ);
CASE(HLSLRWByteAddressBufferType, SLANG_BYTE_ADDRESS_BUFFER, SLANG_RESOURCE_ACCESS_READ_WRITE);
CASE(UntypedBufferResourceType, SLANG_BYTE_ADDRESS_BUFFER, SLANG_RESOURCE_ACCESS_READ);
+
+ // This isn't entirely accurate, but I can live with it for now
+ CASE(GLSLShaderStorageBufferType, SLANG_STRUCTURED_BUFFER, SLANG_RESOURCE_ACCESS_READ_WRITE);
#undef CASE
return SLANG_RESOURCE_ACCESS_NONE;
@@ -400,7 +403,7 @@ SLANG_API SlangReflectionType* spReflectionType_GetResourceResultType(SlangRefle
type = arrayType->BaseType.Ptr();
}
- if (auto textureType = type->As<TextureType>())
+ if (auto textureType = type->As<TextureTypeBase>())
{
return convert(textureType->elementType.Ptr());
}