From f68768887b02df5080d35f0f32b035ef67764cd0 Mon Sep 17 00:00:00 2001 From: Devon Date: Wed, 11 Dec 2024 01:04:58 -0700 Subject: [PATCH] Fix wgsl float texture format inference silent failure (#5831) --- source/slang/slang-emit-wgsl.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp index 8d4b33541b..0e45fd4cf7 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(elementType); - auto intLitVal = as(vectorType->getElementCount())) + if (auto elementVecType = as(elementType)) { - vectorWidth = intLitVal->getValue(); + if (auto intLitVal = as(elementVecType->getElementCount())) + { + vectorWidth = (Int)intLitVal->getValue(); + } + else + { + vectorWidth = 0; + } + elementType = elementVecType->getElementType(); } - elementType = getVectorElementType((IRType*)elementType); if (auto basicType = as(elementType)) { switch (basicType->getBaseType())