summaryrefslogtreecommitdiff
path: root/tests/metal
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-16 10:43:49 -0700
committerGitHub <noreply@github.com>2024-05-16 10:43:49 -0700
commit725735a87b9d223c2afc83bbd049055b1e44a976 (patch)
tree225f381774fb9b5209007ae7fc455a14f57a6fe6 /tests/metal
parent0a6180299352d7a2ec850004564c7a95b37a41c4 (diff)
RasterizerOrder resource for spirv and metal. (#4175)
* RasterizerOrder resource for spirv and metal. Also fixes the byte address buffer logic for metal. * Fix. * Delete commented lines. --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
Diffstat (limited to 'tests/metal')
-rw-r--r--tests/metal/byte-address-buffer.slang30
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));
+}