Skip to content

Commit f687688

Browse files
authored
Fix wgsl float texture format inference silent failure (#5831)
1 parent 3f818cb commit f687688

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

source/slang/slang-emit-wgsl.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,18 @@ static const char* getWgslImageFormat(IRTextureTypeBase* type)
352352
// normally just resolve to unknown.
353353
auto elementType = type->getElementType();
354354
Int vectorWidth = 1;
355-
if (auto vectorType = as<IRVectorType>(elementType);
356-
auto intLitVal = as<IRIntLit>(vectorType->getElementCount()))
355+
if (auto elementVecType = as<IRVectorType>(elementType))
357356
{
358-
vectorWidth = intLitVal->getValue();
357+
if (auto intLitVal = as<IRIntLit>(elementVecType->getElementCount()))
358+
{
359+
vectorWidth = (Int)intLitVal->getValue();
360+
}
361+
else
362+
{
363+
vectorWidth = 0;
364+
}
365+
elementType = elementVecType->getElementType();
359366
}
360-
elementType = getVectorElementType((IRType*)elementType);
361367
if (auto basicType = as<IRBasicType>(elementType))
362368
{
363369
switch (basicType->getBaseType())

0 commit comments

Comments
 (0)