summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevon <devonrutledge03@gmail.com>2024-12-11 01:04:58 -0700
committerGitHub <noreply@github.com>2024-12-11 00:04:58 -0800
commitf68768887b02df5080d35f0f32b035ef67764cd0 (patch)
treeea427e87191ea7f1f7874973ebd553f006e716e1
parent3f818cba29788c2759e137529e8ab843b9cd6d4a (diff)
Fix wgsl float texture format inference silent failure (#5831)
-rw-r--r--source/slang/slang-emit-wgsl.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp
index 8d4b33541..0e45fd4cf 100644
--- a/source/slang/slang-emit-wgsl.cpp
+++ b/source/slang/slang-emit-wgsl.cpp
@@ -352,12 +352,18 @@ static const char* getWgslImageFormat(IRTextureTypeBase* type)
// normally just resolve to unknown.
auto elementType = type->getElementType();
Int vectorWidth = 1;
- if (auto vectorType = as<IRVectorType>(elementType);
- auto intLitVal = as<IRIntLit>(vectorType->getElementCount()))
+ if (auto elementVecType = as<IRVectorType>(elementType))
{
- vectorWidth = intLitVal->getValue();
+ if (auto intLitVal = as<IRIntLit>(elementVecType->getElementCount()))
+ {
+ vectorWidth = (Int)intLitVal->getValue();
+ }
+ else
+ {
+ vectorWidth = 0;
+ }
+ elementType = elementVecType->getElementType();
}
- elementType = getVectorElementType((IRType*)elementType);
if (auto basicType = as<IRBasicType>(elementType))
{
switch (basicType->getBaseType())