summaryrefslogtreecommitdiffstats
path: root/tests/bindings
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-11-01 21:42:12 -0700
committerGitHub <noreply@github.com>2023-11-01 21:42:12 -0700
commit6aca3813c4ccc496c0f9b2db293acb546aa11d2d (patch)
tree5281f0ac62946787db90409c1ab3da5ed3f0fc5c /tests/bindings
parent532c4322c9d9ab2c95a5bb573c89062456b59236 (diff)
Parameter binding and gfx fixes. (#3302)
* Parameter binding and gfx fixes. * Add diagnostics on entry point parameters. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bindings')
-rw-r--r--tests/bindings/nested-parameter-block-2.slang42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/bindings/nested-parameter-block-2.slang b/tests/bindings/nested-parameter-block-2.slang
new file mode 100644
index 000000000..38ce9232e
--- /dev/null
+++ b/tests/bindings/nested-parameter-block-2.slang
@@ -0,0 +1,42 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d12 -use-dxil -shaderobj -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type
+// nested-parameter-block-2.slang
+
+struct CB
+{
+ uint4 value;
+}
+
+struct MaterialSystem
+{
+ CB cb;
+ RWStructuredBuffer<uint4> data;
+}
+
+struct Scene
+{
+ CB sceneCb;
+ RWStructuredBuffer<uint4> data;
+ ParameterBlock<MaterialSystem> material;
+}
+
+//TEST_INPUT: set scene = new Scene { { {1,2,3,4} }, ubuffer(data=[1 2 3 4], stride=4), new MaterialSystem {{ {1,2,3,4} }, ubuffer(data=[1 2 3 4], stride=4)} }
+ParameterBlock<Scene> scene;
+
+struct MyBuffer
+{
+ RWStructuredBuffer<uint4> resultBuffer;
+}
+//TEST_INPUT: set pb2 = new MyBuffer { out ubuffer(data=[0 0 0 0], stride=4) }
+ParameterBlock<MyBuffer> pb2;
+
+// Main entry-point. Applies the transformation encoded by `transformer`
+// to all elements in `buffer`.
+[shader("compute")]
+[numthreads(4,1,1)]
+void computeMain(uint3 sv_dispatchThreadID : SV_DispatchThreadID)
+{
+ // CHECK: 4
+ pb2.resultBuffer[sv_dispatchThreadID.x] = scene.sceneCb.value.x + scene.data[0].x + scene.material.cb.value.x + scene.material.data[0].x;
+}