diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/reflection/global-type-params.slang | 35 | ||||
| -rw-r--r-- | tests/reflection/global-type-params.slang.expected | 127 |
2 files changed, 162 insertions, 0 deletions
diff --git a/tests/reflection/global-type-params.slang b/tests/reflection/global-type-params.slang new file mode 100644 index 000000000..bfeb7fb2e --- /dev/null +++ b/tests/reflection/global-type-params.slang @@ -0,0 +1,35 @@ +//TEST:REFLECTION:-profile ps_4_0 -target hlsl -no-codegen + +// Confirm that we handle global generic parameters + + +float4 u; + +interface IBase +{}; + +__generic_param TParam : IBase; +__generic_param TParam2 : IBase; + +struct S +{ + TParam2 p; +}; + +ParameterBlock<S> arg; +ParameterBlock<TParam> arg1; + +Texture2D t; +SamplerState s; + +cbuffer CB +{ + float4 v; +} + +float4 w; + +float4 main() : SV_Target +{ + return u + v + w + t.Sample(s, u.xy); +}
\ No newline at end of file diff --git a/tests/reflection/global-type-params.slang.expected b/tests/reflection/global-type-params.slang.expected new file mode 100644 index 000000000..1e3a6aa99 --- /dev/null +++ b/tests/reflection/global-type-params.slang.expected @@ -0,0 +1,127 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "u", + "binding": {"kind": "uniform", "offset": 0, "size": 16}, + "type": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + }, + { + "name": "arg", + "binding": {"kind": "generic", "index": 0}, + "type": { + "kind": "parameterBlock", + "elementType": { + "kind": "struct", + "name": "S", + "fields": [ + { + "name": "p", + "type": { + "kind": "GenericTypeParameter", + "name": "TParam2" + }, + "binding": {"kind": "generic", "index": 0} + } + ] + } + } + }, + { + "name": "arg1", + "binding": {"kind": "generic", "index": 0}, + "type": { + "kind": "parameterBlock", + "elementType": { + "kind": "GenericTypeParameter", + "name": "TParam" + } + } + }, + { + "name": "t", + "binding": {"kind": "shaderResource", "index": 0}, + "type": { + "kind": "resource", + "baseShape": "texture2D" + } + }, + { + "name": "s", + "binding": {"kind": "samplerState", "index": 0}, + "type": { + "kind": "samplerState" + } + }, + { + "name": "CB", + "binding": {"kind": "constantBuffer", "index": 1}, + "type": { + "kind": "constantBuffer", + "elementType": { + "kind": "struct", + "fields": [ + { + "name": "v", + "type": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + }, + "binding": {"kind": "uniform", "offset": 0, "size": 16} + } + ] + } + } + }, + { + "name": "w", + "binding": {"kind": "uniform", "offset": 16, "size": 16}, + "type": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + } + ], + "typeParams": + [ + { + "name": "TParam", + constraints: + [ + { + "kind": "Interface", + "name": "IBase" + } + ] + }, + { + "name": "TParam2", + constraints: + [ + { + "kind": "Interface", + "name": "IBase" + } + ] + } + ] +} +} |
