summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-06-28 16:09:06 -0700
committerGitHub <noreply@github.com>2023-06-28 16:09:06 -0700
commitb45e5aa07cf5e2e0bd23cf4c14bb40104b0b641c (patch)
tree52477da6fb0c75fd4e424a68850fdb703006f153 /tests
parent97963c5c119a3445fa6353809669d4553952e66c (diff)
Fix parameter block loads in GLSL emit. (#2946)
* Fix parameter block loads in GLSL emit. * Revert `[NoSideEffect]` declarations in DXR1.1 API. * fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/parameter-block-load.slang31
-rw-r--r--tests/bugs/parameter-block-load.slang.expected.txt2
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/bugs/parameter-block-load.slang b/tests/bugs/parameter-block-load.slang
new file mode 100644
index 000000000..5828d021e
--- /dev/null
+++ b/tests/bugs/parameter-block-load.slang
@@ -0,0 +1,31 @@
+// Test reading parameter block from a member function.
+
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -vk -output-using-type
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -profile sm_5_0 -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=gOutputBuffer
+RWStructuredBuffer<int> gOutputBuffer;
+
+struct MyParameters
+{
+ int x;
+ int y;
+ StructuredBuffer<float> buffer1;
+
+ RWStructuredBuffer<uint3> buffer;
+ int calc()
+ {
+ buffer[0].x = 3;
+ return x + y + buffer[0].x;
+ }
+}
+
+//TEST_INPUT: set gObj = new MyParameters{2, 3, new StructuredBuffer<float>{0.0}, new RWStructuredBuffer<uint3>{{0,0,0}}}
+ParameterBlock<MyParameters> gObj;
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ float result = 0.0;
+ gOutputBuffer[dispatchThreadID.x] = gObj.calc();
+}
diff --git a/tests/bugs/parameter-block-load.slang.expected.txt b/tests/bugs/parameter-block-load.slang.expected.txt
new file mode 100644
index 000000000..e6751c365
--- /dev/null
+++ b/tests/bugs/parameter-block-load.slang.expected.txt
@@ -0,0 +1,2 @@
+type: int32_t
+8