From a6d59d0e102e2d21d411a7ca1f8acaf3bf1f867c Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 10 Apr 2024 12:39:17 -0700 Subject: Properly compile `gl_WorkgroupSize`. (#3925) * Properly compile `gl_WorkgroupSize`. * Update source/slang/slang-ir-translate-glsl-global-var.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --- source/slang/slang-check-modifier.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang-check-modifier.cpp') diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp index af47eaedb..6d39f977c 100644 --- a/source/slang/slang-check-modifier.cpp +++ b/source/slang/slang-check-modifier.cpp @@ -348,8 +348,15 @@ namespace Slang getSink()->diagnose(attr, Diagnostics::nonPositiveNumThreads, constIntVal->getValue()); return false; } + if (intValue->getType() != m_astBuilder->getIntType()) + { + intValue = m_astBuilder->getIntVal(m_astBuilder->getIntType(), constIntVal->getValue()); + } } + // Make sure we always canonicalize the type to int. value = intValue; + if (value->getType() != m_astBuilder->getIntType()) + value = m_astBuilder->getTypeCastIntVal(m_astBuilder->getIntType(), value); } else { -- cgit v1.2.3