summaryrefslogtreecommitdiffstats
path: root/tests/metal
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-03-26 14:42:30 -0500
committerGitHub <noreply@github.com>2025-03-26 12:42:30 -0700
commitb3deec2001ea34e20e9a6af8ddf5cf3866cafac0 (patch)
tree68052183f6c2d3b610a34027e5911113c1506414 /tests/metal
parent05f24d294917a2599d635fe2e53b75cdca26cfdd (diff)
Eliminate empty struct on metal target (#6603)
* Eliminate empty struct on metal target Close 6573. We previously disabled the type legalization for ParameterBlock on Metal, but Metal doesn't allow empty struct in the argument buffer which is mapped from ParameterBlock, so we will need legalizeEmptyTypes on Metal target. * update test * update function name
Diffstat (limited to 'tests/metal')
-rw-r--r--tests/metal/empty-struct-remove.slang33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/metal/empty-struct-remove.slang b/tests/metal/empty-struct-remove.slang
new file mode 100644
index 000000000..2d9ee436b
--- /dev/null
+++ b/tests/metal/empty-struct-remove.slang
@@ -0,0 +1,33 @@
+
+//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute -DMETAL
+//TEST:SIMPLE(filecheck=METAL):-target metal -entry computeMain -stage compute -DMETAL
+
+// METAL-NOT: struct emptyStruct
+struct emptyStruct
+{
+ void set(RWStructuredBuffer<int> buffer, int value) {buffer[0] = value;}
+}
+
+
+struct MyStruct
+{
+ RWStructuredBuffer<int> buffer;
+ int value;
+ void set()
+ {
+ e.set(buffer, value);
+ }
+ emptyStruct e;
+}
+
+ParameterBlock<MyStruct> param;
+
+// LIB: @computeMain
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain(
+ uint tid: SV_DispatchThreadID,
+)
+{
+ param.set();
+}