summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-emit.cpp9
-rw-r--r--source/slang/slang-ir-spirv-legalize.cpp3
2 files changed, 7 insertions, 5 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 543bb089d..c77f2a6ce 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -887,9 +887,12 @@ Result linkAndOptimizeIR(
// above)
legalizeMeshOutputTypes(irModule);
- // We need to lower any types used in a buffer resource (e.g. ContantBuffer or StructuredBuffer) into
- // a simple storage type that has target independent layout based on the kind of buffer resource.
- lowerBufferElementTypeToStorageType(targetRequest, irModule);
+ if (options.shouldLegalizeExistentialAndResourceTypes)
+ {
+ // We need to lower any types used in a buffer resource (e.g. ContantBuffer or StructuredBuffer) into
+ // a simple storage type that has target independent layout based on the kind of buffer resource.
+ lowerBufferElementTypeToStorageType(targetRequest, irModule);
+ }
// Rewrite functions that return arrays to return them via `out` parameter,
// since our target languages doesn't allow returning arrays.
diff --git a/source/slang/slang-ir-spirv-legalize.cpp b/source/slang/slang-ir-spirv-legalize.cpp
index 48c118486..69abaa108 100644
--- a/source/slang/slang-ir-spirv-legalize.cpp
+++ b/source/slang/slang-ir-spirv-legalize.cpp
@@ -254,8 +254,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
// Opaque resource handles can't be in Uniform for Vulkan, if they are
// placed here then put them in UniformConstant instead
- if (storageClass == SpvStorageClassUniform
- && isSpirvUniformConstantType(inst->getDataType()))
+ if (isSpirvUniformConstantType(inst->getDataType()))
{
storageClass = SpvStorageClassUniformConstant;
}