summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-09-19 07:21:17 -0700
committerGitHub <noreply@github.com>2023-09-19 22:21:17 +0800
commit6542d472c9a144818e3e23349e31ae281bbfa499 (patch)
tree29b349106d506bf27f30e9be7984cc96c5a38f62 /source
parentd1efc69a20d941116d1398e4471689658cd6b888 (diff)
Direct SPIRV ParameterBlock fix. (#3212)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-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;
}