diff options
Diffstat (limited to 'tests')
6 files changed, 58 insertions, 14 deletions
diff --git a/tests/compute/entry-point-uniform-params.slang b/tests/compute/entry-point-uniform-params.slang new file mode 100644 index 000000000..f91f7d146 --- /dev/null +++ b/tests/compute/entry-point-uniform-params.slang @@ -0,0 +1,51 @@ +// entry-point-uniform-params.slang + +// Confirm that `uniform` parameters on +// entry points are allowed, and work as expected. + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +struct Signs +{ + int a; +} + +struct Stuff +{ + int b; +} + +struct Things +{ + int c; +} + +// A shader parameter at global scope should be assigned +// a register/binding before any related to the entry point. + +//TEST_INPUT:cbuffer(data=[1 0 0 0]):dxbinding(0),glbinding(0) +ConstantBuffer<Signs> signs; + +[numthreads(4, 1, 1)] +void computeMain( +//TEST_INPUT:cbuffer(data=[2 0 0 0 3 0 0 0]):dxbinding(1),glbinding(1) + uniform Stuff stuff, + uniform Things things, + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(2),out + uniform RWStructuredBuffer<int> outputBuffer, + + uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + + int val = 0; + val = val*16 + signs.a; + val = val*16 + stuff.b; + val = val*16 + things.c; + val = val*16 + tid; + + outputBuffer[tid] = val; +}
\ No newline at end of file diff --git a/tests/compute/entry-point-uniform-params.slang.expected.txt b/tests/compute/entry-point-uniform-params.slang.expected.txt new file mode 100644 index 000000000..ef2c43c16 --- /dev/null +++ b/tests/compute/entry-point-uniform-params.slang.expected.txt @@ -0,0 +1,4 @@ +1230 +1231 +1232 +1233 diff --git a/tests/compute/global-type-param.slang b/tests/compute/global-type-param.slang index 2638852eb..f177dcb1d 100644 --- a/tests/compute/global-type-param.slang +++ b/tests/compute/global-type-param.slang @@ -28,10 +28,10 @@ struct Impl : IBase __generic_param TImpl : IBase; -TImpl impl; - [numthreads(1, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +void computeMain( + uniform TImpl impl, + uint3 dispatchThreadID : SV_DispatchThreadID) { uint tid = dispatchThreadID.x; float outVal = impl.compute(); diff --git a/tests/reflection/sample-index-input.hlsl.expected b/tests/reflection/sample-index-input.hlsl.expected index 5bf5f297e..c799f8f25 100644 --- a/tests/reflection/sample-index-input.hlsl.expected +++ b/tests/reflection/sample-index-input.hlsl.expected @@ -29,7 +29,6 @@ standard output = { "scalarType": "float32" } }, - "stage": "fragment", "binding": {"kind": "varyingInput", "index": 0}, "semanticName": "COLOR" }, diff --git a/tests/reflection/sample-rate-input.hlsl.expected b/tests/reflection/sample-rate-input.hlsl.expected index 0c86ebecb..ec6cfca6e 100644 --- a/tests/reflection/sample-rate-input.hlsl.expected +++ b/tests/reflection/sample-rate-input.hlsl.expected @@ -29,7 +29,6 @@ standard output = { "scalarType": "float32" } }, - "stage": "fragment", "binding": {"kind": "varyingInput", "index": 0}, "semanticName": "EXTRA" }, @@ -43,7 +42,6 @@ standard output = { "scalarType": "float32" } }, - "stage": "fragment", "binding": {"kind": "varyingInput", "index": 1}, "semanticName": "COLOR" } diff --git a/tests/reflection/vertex-input-semantics.hlsl.expected b/tests/reflection/vertex-input-semantics.hlsl.expected index 06b7bc95a..2ff8d7847 100644 --- a/tests/reflection/vertex-input-semantics.hlsl.expected +++ b/tests/reflection/vertex-input-semantics.hlsl.expected @@ -44,7 +44,6 @@ standard output = { "scalarType": "int32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 0}, "semanticName": "B" }, @@ -64,7 +63,6 @@ standard output = { "scalarType": "float32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 0}, "semanticName": "B", "semanticIndex": 1 @@ -79,14 +77,12 @@ standard output = { "scalarType": "float32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 1}, "semanticName": "B", "semanticIndex": 2 } ] }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 1, "count": 2}, "semanticName": "B", "semanticIndex": 1 @@ -118,7 +114,6 @@ standard output = { "scalarType": "float32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 0}, "semanticName": "CX" }, @@ -132,14 +127,12 @@ standard output = { "scalarType": "float32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 1}, "semanticName": "CX", "semanticIndex": 1 } ] }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 0, "count": 2}, "semanticName": "CX" }, @@ -153,7 +146,6 @@ standard output = { "scalarType": "int32" } }, - "stage": "vertex", "binding": {"kind": "varyingInput", "index": 2}, "semanticName": "CY" } |
