summaryrefslogtreecommitdiff
path: root/tools/gfx-unit-test/nested-parameter-block.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-01-14 13:08:46 -0800
committerGitHub <noreply@github.com>2022-01-14 13:08:46 -0800
commitb2f4cb118ef15cbf522be0335e4084ac6db57672 (patch)
tree37c2d6c3519ef7fc3d60142a4a31cbe16708e0bc /tools/gfx-unit-test/nested-parameter-block.slang
parentd3f904cbfa1568366bc8c8d231a57a03d47ddc98 (diff)
Various fixes to GFX, nested parameter block test for d3d12. (#2081)
* Various fixes. * Add nested parameter block test. * Remove slang-llvm licence info * Ingore slang-llvm/ directory. * Fixup. Co-authored-by: Yong He <yhe@nvidia.com>
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;
+}