From 50f44c178de4c614dc45fc48938e6881c0373f6a Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Wed, 9 Oct 2024 01:23:56 +0800 Subject: Look through attributes and rates when determining by reference initialization (#5023) * Look through attributes and rates when determining by reference initialization Closes #5022 * Make type of unwrapAttributedType more specific * loosen type of unwrapAttributedType * Discard changes to source/slang/slang-emit-spirv.cpp * Discard changes to source/slang/slang-ir-check-differentiability.cpp * Discard changes to source/slang/slang-ir.cpp * Discard changes to source/slang/slang-ir.h * Update slang-ir-use-uninitialized-values.cpp * Remove redundant cast --------- Co-authored-by: Yong He --- tests/bugs/gh-5022.slang | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/bugs/gh-5022.slang (limited to 'tests') diff --git a/tests/bugs/gh-5022.slang b/tests/bugs/gh-5022.slang new file mode 100644 index 000000000..6d1b71991 --- /dev/null +++ b/tests/bugs/gh-5022.slang @@ -0,0 +1,22 @@ +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu + +// CHECK: 0 +// CHECK-NEXT: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +groupshared int myInt; + +void set(__ref groupshared int i){ i = 1; } +int use(__ref groupshared int i){ return i; } + +[numthreads(4, 1, 1)] +void computeMain(uint i : SV_GroupIndex) +{ + set(myInt); + use(myInt); + outputBuffer[i] = i; +} -- cgit v1.2.3