Skip to content

Commit 12137e9

Browse files
authored
Fix redundant decorations in IRParam (shader-slang#4964)
* Fix redundant decorations in IRParam Closes shader-slang#4922 The problem was that same decorations were added to an IRParam multiple times while running `specializeIRForEntryPoint()`. `cloneGlobalValueWithCodeCommon()` kept cloning decorations for the params that were already processed.
1 parent ddf4a32 commit 12137e9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

source/slang/slang-ir-link.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,9 @@ void cloneGlobalValueWithCodeCommon(
751751
IRParam* originalParam;
752752
IRParam* clonedParam;
753753
};
754-
ShortList<ParamCloneInfo> paramCloneInfos;
755754
while (ob)
756755
{
756+
ShortList<ParamCloneInfo> paramCloneInfos;
757757
SLANG_ASSERT(cb);
758758

759759
builder->setInsertInto(cb);
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry main
2+
//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry main
3+
4+
// This test checks if `nointerpolation` is emitted more than once
5+
//HLSL-NOT:nointerpolation nointerpolation
6+
//GLSL-NOT:flat flat
7+
8+
[shader("pixel")]
9+
void main(out float4 SV_Target : SV_Target, const in nointerpolation float4 color : color)
10+
{
11+
for (int i = 0; i < 10; ++i)
12+
{}
13+
14+
SV_Target = color;
15+
}

0 commit comments

Comments
 (0)