From ed0681164d78591148781d08934676bfec63f9da Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:02:13 -0700 Subject: Keep const-ness in generic functions (#4028) * Keep const-ness in generic functions Closes #3834 The issue was that "const" variables inside of generic functions became non-const variables. This issue prevented some of GLSL texture functions from being called inside of generic functions. When `propagateConstExpr()` iterates the global functions, the generic functions had to be handled little differently. This commit allows the iteration to happen for the generic functions. * Adding an explantion of the test as a comment --- source/slang/slang-ir-constexpr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source') diff --git a/source/slang/slang-ir-constexpr.cpp b/source/slang/slang-ir-constexpr.cpp index 7a93a312c..199f8f8b0 100644 --- a/source/slang/slang-ir-constexpr.cpp +++ b/source/slang/slang-ir-constexpr.cpp @@ -650,6 +650,14 @@ void propagateConstExpr( default: break; + case kIROp_Generic: + { + auto gen = as(gv); + gv = as(findGenericReturnVal(gen)); + if (nullptr == gv) + break; + } + [[fallthrough]]; case kIROp_Func: case kIROp_GlobalVar: { -- cgit v1.2.3