diff options
Diffstat (limited to 'tests/bugs/mutating/buffer-write-dce.slang')
| -rw-r--r-- | tests/bugs/mutating/buffer-write-dce.slang | 28 |
1 files changed, 28 insertions, 0 deletions
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<C> 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 |
