From 0c04885da9edc3df7a1ef5cb520be1bd29eb13e4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 10 Feb 2022 11:50:07 -0800 Subject: 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 Co-authored-by: jsmall-nvidia --- tools/gfx-unit-test/root-shader-parameter.slang | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tools/gfx-unit-test/root-shader-parameter.slang (limited to 'tools/gfx-unit-test/root-shader-parameter.slang') 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 c0; + [root] RWStructuredBuffer c1; + StructuredBuffer c2; +} + +struct S0 +{ + StructuredBuffer b0; + [root] StructuredBuffer b1; + ParameterBlock s1; + ConstantBuffer s2; +} + +ParameterBlock g; +[root] RWStructuredBuffer 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 +} -- cgit v1.2.3