diff options
| author | Yong He <yonghe@outlook.com> | 2024-07-25 15:00:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-25 15:00:14 -0700 |
| commit | c9d89a40775a055873adf82cfb0ee1cb6bdcb93c (patch) | |
| tree | 2438f353e87b30febe966ca23976793637c018d2 /tests/spirv | |
| parent | 1343ab79fcd0ff9e5ffebbcf95414e51ab19e9cd (diff) | |
Overhaul IR lowering of pointer types. (#4710)
* Overhaul IR lowering of pointer types.
* Propagate address space in IRBuilder.
* Fixup.
* Fix.
* Fix.
* Change how Ptr type is printed to text.
* Fix.
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/pointer-array-2.slang | 27 | ||||
| -rw-r--r-- | tests/spirv/pointer-data-marshal.slang | 21 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/spirv/pointer-array-2.slang b/tests/spirv/pointer-array-2.slang new file mode 100644 index 000000000..e6f002b5d --- /dev/null +++ b/tests/spirv/pointer-array-2.slang @@ -0,0 +1,27 @@ +struct input_t { + uint32_t i : 8; + uint32_t j : 24; +}; + +struct output_t { + uint32_t i; + uint32_t j; +}; + +uniform void *parameters[1000]; + +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +//CHECK: OpEntryPoint + +[shader("compute")] +[numthreads(1, 1, 1)] +void main(uint3 dispatchThreadID: SV_DispatchThreadID, uint groupIndex: SV_GroupIndex) { + // buffer 0 is input + // buffer 1 is output + input_t *input = (input_t *)(parameters[0]); + output_t *output = (output_t *)(parameters[1]); + + output->i = input->i; + output->j = input->j; +}
\ No newline at end of file diff --git a/tests/spirv/pointer-data-marshal.slang b/tests/spirv/pointer-data-marshal.slang new file mode 100644 index 000000000..3ad6c373b --- /dev/null +++ b/tests/spirv/pointer-data-marshal.slang @@ -0,0 +1,21 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly + +struct Foo { + column_major float3x2 m; +}; + +struct Params { + Foo *foo; +}; + +// CHECK: %[[PTR0:[A-Za-z0-9_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer__arr_v3float_int_2 %{{.*}} %int_0 +// CHECK: %[[PTR1:[A-Za-z0-9_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_v3float %[[PTR0]] %int_1 +// CHECK: %[[PTR2:[A-Za-z0-9_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_float %[[PTR1]] %int_2 + +ConstantBuffer<Params> params; + +[shader("compute")] +[numthreads(1,1,1)] +void main() { + params.foo.m[2][1] += 1.0; +}
\ No newline at end of file |
