diff options
Diffstat (limited to 'tests/reflection')
| -rw-r--r-- | tests/reflection/default-space.slang | 23 | ||||
| -rw-r--r-- | tests/reflection/default-space.slang.expected | 44 |
2 files changed, 67 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; } diff --git a/tests/reflection/default-space.slang.expected b/tests/reflection/default-space.slang.expected new file mode 100644 index 000000000..548de2be0 --- /dev/null +++ b/tests/reflection/default-space.slang.expected @@ -0,0 +1,44 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "a", + "binding": {"kind": "shaderResource", "space": 99, "index": 0}, + "type": { + "kind": "resource", + "baseShape": "texture2D" + } + }, + { + "name": "b", + "binding": {"kind": "registerSpace", "index": 0}, + "type": { + "kind": "parameterBlock", + "elementType": { + "kind": "struct", + "name": "B", + "fields": [ + { + "name": "b", + "type": { + "kind": "resource", + "baseShape": "texture2D" + }, + "binding": {"kind": "shaderResource", "index": 0} + } + ] + } + } + } + ], + "entryPoints": [ + { + "name": "main", + "stage:": "fragment" + } + ] +} +} |
