diff options
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; +} |
