diff options
| author | Yong He <yonghe@outlook.com> | 2025-07-01 19:09:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 02:09:29 +0000 |
| commit | c701ec00ccce6dfa8094d6550ce2db929fc8cefe (patch) | |
| tree | 4f729e8fa5700b2d6d7d99f34514682e3ad351f8 /tests/diagnostics/parameter-block-to-mutating-func.slang | |
| parent | 83c72fd8772d312233f4e3ccd4154b81030d4795 (diff) | |
Defer immutable buffer loads when emitting spirv. (#7579)
* Defer immutable buffer loads when emitting spirv.
* Fix.
* Fix.
* Fix.
* Fix tests.
* Fix test.
Diffstat (limited to 'tests/diagnostics/parameter-block-to-mutating-func.slang')
| -rw-r--r-- | tests/diagnostics/parameter-block-to-mutating-func.slang | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/diagnostics/parameter-block-to-mutating-func.slang b/tests/diagnostics/parameter-block-to-mutating-func.slang new file mode 100644 index 000000000..b5bdb4550 --- /dev/null +++ b/tests/diagnostics/parameter-block-to-mutating-func.slang @@ -0,0 +1,27 @@ +//TEST:SIMPLE(filecheck=CHECK):-target spirv +struct Data { + StructuredBuffer<float> input[2]; + RWStructuredBuffer<float> output; + uint input_tensor_count; + StructuredBuffer<uint> index_buffer; + uint index_count; + + [mutating] + float fetch(int buffer, int index) + { + return input[buffer][index]; + } +}; + +[shader("compute")] +[numthreads(8, 8, 1)] +void compute_main(uint3 tid: SV_DispatchThreadID, ParameterBlock<Data> data) +{ + float result = 0.0; + for (int i = 0; i < data.index_count; ++i) { + uint buffer = data.index_buffer[i]; + //CHECK: ([[# @LINE+1]]): error + result += data.fetch(buffer, tid.x * 1024 + tid.y); + } + data.output[tid.x * 1024 + tid.y] = result; +} |
