diff options
Diffstat (limited to 'tests/metal')
| -rw-r--r-- | tests/metal/byte-address-buffer.slang | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/metal/byte-address-buffer.slang b/tests/metal/byte-address-buffer.slang new file mode 100644 index 000000000..f3169ebf4 --- /dev/null +++ b/tests/metal/byte-address-buffer.slang @@ -0,0 +1,30 @@ +//TEST:SIMPLE(filecheck=CHECK): -target metal +//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib + +uniform RWStructuredBuffer<float> outputBuffer; + +RWByteAddressBuffer buffer; + +// CHECK-ASM: define void @main_kernel + +struct TestStruct +{ + uint8_t a; + float16_t h; + float b; + float4 c; + float4x3 d; +} + +[numthreads(1,1,1)] +void main_kernel(uint3 tid: SV_DispatchThreadID) +{ + // CHECK: uint [[WORD0:[a-zA-Z0-9_]+]] = as_type<uint>({{.*}}[(int(0))>>2]); + // CHECK: uint8_t [[A:[a-zA-Z0-9_]+]] = uint8_t([[WORD0]] >> int(0) & 255U); + // CHECK: uint [[WORD1:[a-zA-Z0-9_]+]] = as_type<uint>({{.*}}[(int(0))>>2]); + // CHECK: half [[H:[a-zA-Z0-9_]+]] = as_type<half>(uint16_t([[WORD1]] >> int(16) & 65535U)); + + // CHECK: {{.*}}[(int(128))>>2] = as_type<uint32_t>(({{.*}} & 4294967040U) | uint([[A]]) << int(0)); + // CHECK: {{.*}}[(int(128))>>2] = as_type<uint32_t>(({{.*}} & 65535U) | uint(as_type<uint16_t>([[H]])) << int(16)); + buffer.Store(128, buffer.Load<TestStruct>(0)); +} |
