summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-ir-link.cpp2
-rw-r--r--tests/bugs/gh-4922-nointerpolation.slang15
2 files changed, 16 insertions, 1 deletions
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp
index 94ba75a44..5865d5320 100644
--- a/source/slang/slang-ir-link.cpp
+++ b/source/slang/slang-ir-link.cpp
@@ -751,9 +751,9 @@ void cloneGlobalValueWithCodeCommon(
IRParam* originalParam;
IRParam* clonedParam;
};
- ShortList<ParamCloneInfo> paramCloneInfos;
while (ob)
{
+ ShortList<ParamCloneInfo> paramCloneInfos;
SLANG_ASSERT(cb);
builder->setInsertInto(cb);
diff --git a/tests/bugs/gh-4922-nointerpolation.slang b/tests/bugs/gh-4922-nointerpolation.slang
new file mode 100644
index 000000000..3619aae0b
--- /dev/null
+++ b/tests/bugs/gh-4922-nointerpolation.slang
@@ -0,0 +1,15 @@
+//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry main
+//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry main
+
+// This test checks if `nointerpolation` is emitted more than once
+//HLSL-NOT:nointerpolation nointerpolation
+//GLSL-NOT:flat flat
+
+[shader("pixel")]
+void main(out float4 SV_Target : SV_Target, const in nointerpolation float4 color : color)
+{
+ for (int i = 0; i < 10; ++i)
+ {}
+
+ SV_Target = color;
+}