summaryrefslogtreecommitdiff
path: root/tests/reflection/default-space.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reflection/default-space.slang')
-rw-r--r--tests/reflection/default-space.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/reflection/default-space.slang b/tests/reflection/default-space.slang
new file mode 100644
index 000000000..666714b79
--- /dev/null
+++ b/tests/reflection/default-space.slang
@@ -0,0 +1,23 @@
+//TEST:REFLECTION:-profile sm_5_1 -stage fragment -target hlsl
+
+// This test is to confirm that we do not allocate a "default"
+// space/set for global shader parameters unless it is
+// really required. In particular, if there are global-scope
+// resource parameters *but* they are all explicitly bound,
+// then a default space isn't needed.
+
+
+// An explicitly-bound global texture.
+Texture2D a : register(t0, space99);
+
+// An implicitly-bound global parameter block.
+//
+// This parameter should be given `space0`, because
+// it is the first available space after all explicitly-bound
+// parameters have claimed their registers/spaces.
+//
+struct B { Texture2D b; }
+ParameterBlock<B> b;
+
+float4 main() : SV_Target
+{ return 0.0; }