diff options
| author | Yong He <yonghe@outlook.com> | 2024-05-08 23:05:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-08 23:05:14 -0700 |
| commit | 526430a0e7053b04eeb9b0c6514065a850042aaf (patch) | |
| tree | 51f760230f7bcb6b7f49a7c45708260f413a0078 /tests/spirv | |
| parent | 8e86121b6ce0f2995050ebe112306ded6bc87ca2 (diff) | |
Support `getAddress` of a single-element vector swizzle. (#4138)
Fixes #4112.
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/ptr-vector-member.slang | 19 | ||||
| -rw-r--r-- | tests/spirv/vector-member-atomic.slang | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/spirv/ptr-vector-member.slang b/tests/spirv/ptr-vector-member.slang new file mode 100644 index 000000000..0683d8838 --- /dev/null +++ b/tests/spirv/ptr-vector-member.slang @@ -0,0 +1,19 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK: %[[PTR:[0-9a-zA-Z_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %16 %int_0 +// CHECK: %{{.*}} = OpAtomicIAdd %uint %[[PTR]] %uint_1 %uint_0 %uint_1 + +struct Push2 +{ + uint4 * value; +}; + +[[vk::push_constant]] Push2 push2; + +[shader("compute")] +[numthreads(1, 1, 1)] +void main() +{ + uint * v = &push2.value[0].x; + InterlockedAdd(*v, 1); +}
\ No newline at end of file diff --git a/tests/spirv/vector-member-atomic.slang b/tests/spirv/vector-member-atomic.slang new file mode 100644 index 000000000..439cfce9c --- /dev/null +++ b/tests/spirv/vector-member-atomic.slang @@ -0,0 +1,19 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK: %[[PTR:[0-9a-zA-Z_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %16 %int_0 +// CHECK: %{{.*}} = OpAtomicIAdd %uint %[[PTR]] %uint_1 %uint_0 %uint_1 + + +struct Push2 +{ + uint4 * value; +}; + +[[vk::push_constant]] Push2 push2; + +[shader("compute")] +[numthreads(1, 1, 1)] +void main() +{ + InterlockedAdd(push2.value[0].x, 1); +}
\ No newline at end of file |
