From 54364eb1aef3fc6aa87b144ba91ca0a77818e4a4 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Sun, 9 Jul 2017 17:09:58 -0700 Subject: 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. --- source/slang/reflection.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/slang/reflection.cpp') 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()) + else if (auto textureType = type->As()) { return SLANG_TYPE_KIND_RESOURCE; } @@ -326,7 +326,7 @@ SLANG_API SlangResourceShape spReflectionType_GetResourceShape(SlangReflectionTy type = arrayType->BaseType.Ptr(); } - if(auto textureType = type->As()) + if(auto textureType = type->As()) { return textureType->getShape(); } @@ -363,7 +363,7 @@ SLANG_API SlangResourceAccess spReflectionType_GetResourceAccess(SlangReflection type = arrayType->BaseType.Ptr(); } - if(auto textureType = type->As()) + if(auto textureType = type->As()) { 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()) + if (auto textureType = type->As()) { return convert(textureType->elementType.Ptr()); } -- cgit v1.2.3