diff options
| author | Yong He <yonghe@outlook.com> | 2023-06-29 14:23:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-29 14:23:35 -0700 |
| commit | 47d0e8abe4f2fe3c2eede35079676210d1db0b1a (patch) | |
| tree | 32eedef9fa39875c9bd4f5014846d003a9695ff4 /tests/bugs/mutating/buffer-write-dce.slang | |
| parent | 7f0c27a5ac40c1658daa05affd585c3dd0bbf415 (diff) | |
Small fixes to GLSL-legalize and func-property prop. (#2950)
Co-authored-by: Yong He <yhe@nvidia.com>
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 |
