summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-specialize-resources.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-02-03 12:29:12 -0800
committerGitHub <noreply@github.com>2024-02-03 12:29:12 -0800
commit6dca7e39292e6c5672440f6f1dbfb204a79b90d2 (patch)
tree8f6d3c51bf0195d94c34043db5c8b29f18c16b2e /source/slang/slang-ir-specialize-resources.cpp
parent14764896c34b230a5563f48d8b8e565de2f3aa10 (diff)
Fix spirv emit that leads to pathological downstream time. (#3546)
Diffstat (limited to 'source/slang/slang-ir-specialize-resources.cpp')
-rw-r--r--source/slang/slang-ir-specialize-resources.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/slang/slang-ir-specialize-resources.cpp b/source/slang/slang-ir-specialize-resources.cpp
index cfab3fb13..4fd87e173 100644
--- a/source/slang/slang-ir-specialize-resources.cpp
+++ b/source/slang/slang-ir-specialize-resources.cpp
@@ -38,6 +38,7 @@ struct ResourceParameterSpecializationCondition : FunctionCallSpecializeConditio
// our decision.
//
type = unwrapArray(type);
+ bool isArray = type != param->getDataType();
// On all of our (current) targets, a function that
// takes a `ConstantBuffer<T>` parameter requires
@@ -63,7 +64,7 @@ struct ResourceParameterSpecializationCondition : FunctionCallSpecializeConditio
if( isKhronosTarget(targetRequest) )
{
if (targetRequest->shouldEmitSPIRVDirectly())
- return isIllegalSPIRVParameterType(type);
+ return isIllegalSPIRVParameterType(type, isArray);
else
return isIllegalGLSLParameterType(type);
}
@@ -1212,7 +1213,7 @@ bool specializeResourceUsage(
bool isIllegalGLSLParameterType(IRType* type)
{
- if (as<IRUniformParameterGroupType>(type))
+ if (as<IRParameterGroupType>(type))
return true;
if (as<IRHLSLStructuredBufferTypeBase>(type))
return true;
@@ -1236,7 +1237,7 @@ bool isIllegalGLSLParameterType(IRType* type)
return false;
}
-bool isIllegalSPIRVParameterType(IRType* type)
+bool isIllegalSPIRVParameterType(IRType* type, bool isArray)
{
if (isIllegalGLSLParameterType(type))
return true;
@@ -1245,6 +1246,13 @@ bool isIllegalSPIRVParameterType(IRType* type)
// all Texture types.
if (as<IRTextureType>(type))
return true;
+ if (isArray)
+ {
+ if (as<IRSamplerStateTypeBase>(type))
+ {
+ return true;
+ }
+ }
return false;
}
} // namespace Slang