summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/nested-parameter-block.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx-unit-test/nested-parameter-block.slang')
-rw-r--r--tools/gfx-unit-test/nested-parameter-block.slang37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/gfx-unit-test/nested-parameter-block.slang b/tools/gfx-unit-test/nested-parameter-block.slang
new file mode 100644
index 000000000..f8995f9c9
--- /dev/null
+++ b/tools/gfx-unit-test/nested-parameter-block.slang
@@ -0,0 +1,37 @@
+// parameter-block.slang
+
+struct CB
+{
+ uint4 value;
+}
+
+struct MaterialSystem
+{
+ CB cb;
+ StructuredBuffer<uint4> data;
+}
+
+struct Scene
+{
+ CB sceneCb;
+ StructuredBuffer<uint4> data;
+ ParameterBlock<MaterialSystem> material;
+}
+
+cbuffer PerView
+{
+ uint4 value;
+}
+
+ParameterBlock<Scene> scene;
+
+RWStructuredBuffer<uint4> resultBuffer;
+
+// 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)
+{
+ resultBuffer[sv_dispatchThreadID.x] = value.x + scene.sceneCb.value.x + scene.data[0].x + scene.material.cb.value.x + scene.material.data[0].x;
+}