diff options
| -rw-r--r-- | source/slang/ir-link.cpp | 2 | ||||
| -rw-r--r-- | tests/bugs/static-var.slang | 22 | ||||
| -rw-r--r-- | tests/bugs/static-var.slang.expected.txt | 4 |
3 files changed, 27 insertions, 1 deletions
diff --git a/source/slang/ir-link.cpp b/source/slang/ir-link.cpp index 586172cb2..25d3b40b6 100644 --- a/source/slang/ir-link.cpp +++ b/source/slang/ir-link.cpp @@ -990,7 +990,7 @@ IRInst* cloneGlobalValueWithLinkage( { // If there is no mangled name, then we assume this is a local symbol, // and it can't possibly have multiple declarations. - return cloneGlobalValueImpl(context, originalVal, IROriginalValuesForClone()); + return cloneGlobalValueImpl(context, originalVal, IROriginalValuesForClone(originalVal)); } // diff --git a/tests/bugs/static-var.slang b/tests/bugs/static-var.slang new file mode 100644 index 000000000..f060586ad --- /dev/null +++ b/tests/bugs/static-var.slang @@ -0,0 +1,22 @@ +// gh-775-ext.slang +//TEST(compute):COMPARE_COMPUTE: + +int test(int inVal) +{ + static int kVal = 16; + return inVal + kVal; +} + +//TEST_INPUT:ubuffer(data=[9 9 9 9], stride=4):dxbinding(0),glbinding(0),out +RWStructuredBuffer<int> outputBuffer : register(u0); + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + int inVal = int(tid); + int outVal = test(inVal); + + outputBuffer[tid] = outVal; +}
\ No newline at end of file diff --git a/tests/bugs/static-var.slang.expected.txt b/tests/bugs/static-var.slang.expected.txt new file mode 100644 index 000000000..a0d427709 --- /dev/null +++ b/tests/bugs/static-var.slang.expected.txt @@ -0,0 +1,4 @@ +10 +11 +12 +13 |
