From 47d0e8abe4f2fe3c2eede35079676210d1db0b1a Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 29 Jun 2023 14:23:35 -0700 Subject: Small fixes to GLSL-legalize and func-property prop. (#2950) Co-authored-by: Yong He --- tests/bugs/mutating/buffer-write-dce.slang | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/bugs/mutating/buffer-write-dce.slang (limited to 'tests/bugs/mutating/buffer-write-dce.slang') diff --git a/tests/bugs/mutating/buffer-write-dce.slang b/tests/bugs/mutating/buffer-write-dce.slang new file mode 100644 index 000000000..c784531d3 --- /dev/null +++ b/tests/bugs/mutating/buffer-write-dce.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +// Confirm that calling a mutating method to write to a buffer location doesn't +// get DCE'd. + +struct C +{ + int a; + [mutating] + void set(int val) + { + a = val; + } +} + +//TEST_INPUT:ubuffer(data=[0], stride=4):out, name outputBuffer +RWStructuredBuffer outputBuffer; +void writeOutput(int tid) +{ + outputBuffer[tid].set(1); +} + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + writeOutput(tid); +} \ No newline at end of file -- cgit v1.2.3