summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Helferty (NVIDIA) <jhelferty@nvidia.com>2025-07-03 17:06:53 -0400
committerGitHub <noreply@github.com>2025-07-03 21:06:53 +0000
commitebfb8d0428b12d3a6cd6de8ebeb13297004cfbe8 (patch)
tree5e6209b0e798e1b8800328c142f0096da5c1158e /tests
parent279de50f9d717e5036b08e17fa937f7881f776e6 (diff)
Fix for mixed block/embedded usage of structs in SPIRV (#7608)
* Add test for mixed use of uniform/ParameterBlock Adds a test that uses the same struct as a parameter and as a ParameterBlock. * Fix for SPIRV block declaration issue Fixes #7431 * Fix formatting * Collect struct param usage in first pass Reduces number of iterations over the entire program. * more formatting fixes * formatting * Remove unused variable
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-7431.slang37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/bugs/gh-7431.slang b/tests/bugs/gh-7431.slang
new file mode 100644
index 000000000..d6c8ff342
--- /dev/null
+++ b/tests/bugs/gh-7431.slang
@@ -0,0 +1,37 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECKOUT):-vk -compute -output-using-type
+
+// CHECKOUT: 10
+// CHECKOUT-NEXT: 20
+// CHECKOUT-NEXT: 30
+// CHECKOUT-NEXT: 40
+
+struct Test {
+ int f_int;
+};
+
+ParameterBlock<Test> pb_struct;
+uniform Test u_struct;
+uniform Test u_struct_array[2];
+
+RWStructuredBuffer<int> results;
+
+//TEST_INPUT: set pb_struct = new Test{10};
+//TEST_INPUT: uniform(data=[20 0 0 0]):name=u_struct.f_int
+//TEST_INPUT: uniform(data=[30 0 0 0]):name=u_struct_array[0].f_int
+//TEST_INPUT: uniform(data=[40 0 0 0]):name=u_struct_array[1].f_int
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=results
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain(uint3 tid: SV_DispatchThreadID)
+{
+ if (any(tid != uint3(0)))
+ return;
+
+ results[0] = pb_struct.f_int;
+ results[1] = u_struct.f_int;
+ results[2] = u_struct_array[0].f_int;
+ results[3] = u_struct_array[1].f_int;
+}
+