summaryrefslogtreecommitdiff
path: root/tests/compute/parameter-block.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute/parameter-block.slang')
-rw-r--r--tests/compute/parameter-block.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/compute/parameter-block.slang b/tests/compute/parameter-block.slang
new file mode 100644
index 000000000..d10a1e9c2
--- /dev/null
+++ b/tests/compute/parameter-block.slang
@@ -0,0 +1,28 @@
+//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir
+//TEST(compute):COMPARE_COMPUTE:
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(1),glbinding(1)
+
+// Ensure that Slang `ParameterBlock` type is lowered
+// to HLSL in the fashion that we expect.
+
+struct P
+{
+ RWStructuredBuffer<int> buffer;
+};
+
+ParameterBlock<P> block0;
+ParameterBlock<P> block1;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ int inVal = block1.buffer[tid];
+
+ int outVal = inVal;
+
+ block0.buffer[tid] = outVal;
+} \ No newline at end of file