summaryrefslogtreecommitdiff
path: root/tools/gfx-unit-test/root-shader-parameter.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-02-10 11:50:07 -0800
committerGitHub <noreply@github.com>2022-02-10 11:50:07 -0800
commit0c04885da9edc3df7a1ef5cb520be1bd29eb13e4 (patch)
tree401c9220c3dcf23e4698405e00fe3b5176e0e472 /tools/gfx-unit-test/root-shader-parameter.slang
parent15f07d14b5f048dc355536cbdf5cf9c10291b13b (diff)
gfx: support d3d12 root parameters (#2122)
* Various fixes to gfx. * Fix. * Fixes. * Fix. * gfx: support root parameter via user-defined attribute. * Fix. * Fix. * Skip d3d12 tests on win x86. * Fixes. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
Diffstat (limited to 'tools/gfx-unit-test/root-shader-parameter.slang')
-rw-r--r--tools/gfx-unit-test/root-shader-parameter.slang32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/gfx-unit-test/root-shader-parameter.slang b/tools/gfx-unit-test/root-shader-parameter.slang
new file mode 100644
index 000000000..bf7af1851
--- /dev/null
+++ b/tools/gfx-unit-test/root-shader-parameter.slang
@@ -0,0 +1,32 @@
+// root-shader-parameter.slang
+
+// Test use of root shader parameters.
+[__AttributeUsage(_AttributeTargets.Var)]
+struct rootAttribute {};
+
+struct S1
+{
+ StructuredBuffer<uint> c0;
+ [root] RWStructuredBuffer<uint> c1;
+ StructuredBuffer<uint> c2;
+}
+
+struct S0
+{
+ StructuredBuffer<uint> b0;
+ [root] StructuredBuffer<uint> b1;
+ ParameterBlock<S1> s1;
+ ConstantBuffer<S1> s2;
+}
+
+ParameterBlock<S0> g;
+[root] RWStructuredBuffer<uint> buffer;
+
+[shader("compute")]
+[numthreads(1,1,1)]
+void computeMain(
+ uint3 sv_dispatchThreadID : SV_DispatchThreadID)
+{
+ buffer[0] = g.b0[0] - g.b1[0] + g.s1.c0[0] - g.s1.c1[0] + g.s1.c2[0] + g.s2.c0[0] - g.s2.c1[0] + g.s2.c2[0];
+ // 10-1+2-3+4+5-6+7
+}