diff options
| author | Anders Leino <aleino@nvidia.com> | 2024-11-25 10:15:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-25 08:15:20 +0000 |
| commit | aaca2d2b615ce113ae9eff11a6fc01f579471b12 (patch) | |
| tree | 2f6c5d04180888a25825cc5ad76e818ccf84c375 /tests/render | |
| parent | e30f0537126f611b7cad81404f9d0c19c6b57ddf (diff) | |
wgsl: Fix field semantics even if input struct doesn't need flattening (#5642)
* wgsl: Fix field semantics even if input struct doesn't need flattening
Helps to address issue #5633.
* Add test for multiple stage IO locations
This verifies part of issue #5633.
Diffstat (limited to 'tests/render')
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang | 78 | ||||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.1.expected | 5 | ||||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.1.expected.png | bin | 0 -> 36676 bytes | |||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.2.expected | 5 | ||||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.2.expected.png | bin | 0 -> 36676 bytes | |||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.expected | 5 | ||||
| -rw-r--r-- | tests/render/multiple-stage-io-locations.slang.expected.png | bin | 0 -> 36676 bytes |
7 files changed, 93 insertions, 0 deletions
diff --git a/tests/render/multiple-stage-io-locations.slang b/tests/render/multiple-stage-io-locations.slang new file mode 100644 index 000000000..9f74d1398 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang @@ -0,0 +1,78 @@ +//TEST(smoke,render):COMPARE_HLSL_RENDER: +// TODO: Investigate Metal failure +//DISABLE_TEST(smoke,render):COMPARE_HLSL_RENDER: -mtl + +cbuffer Uniforms +{ + float4x4 modelViewProjection; +} + +struct AssembledVertex +{ + float3 position; + float3 color; +}; + +struct Fragment +{ + float4 color; +}; + +// Vertex Shader + +struct VertexStageInput +{ + AssembledVertex assembledVertex : A; +}; + +struct VertexStageOutput +{ + float3 color : VERTEX_COLOR; + float3 localPosition : VERTEX_LOCAL_POSITION; + float4 sv_position : SV_Position; +}; + +VertexStageOutput vertexMain(VertexStageInput input) +{ + VertexStageOutput output; + + float3 position = input.assembledVertex.position; + float3 color = input.assembledVertex.color; + + output.color = color; + output.sv_position = mul(modelViewProjection, float4(position, 1.0)); + output.localPosition = position; + + return output; +} + +// Fragment Shader + +struct FragmentStageInput +{ + float3 color : VERTEX_COLOR; + float3 localPosition : VERTEX_LOCAL_POSITION; +}; + +struct FragmentStageOutput +{ + Fragment fragment : SV_Target; +}; + +FragmentStageOutput fragmentMain(FragmentStageInput input) +{ + FragmentStageOutput output; + + float3 color = input.color; + + if (input.color.y < input.color.z) + { + output.fragment.color = float4(input.localPosition, 1.0); + } + else + { + output.fragment.color = float4(input.color, 1.0); + } + + return output; +} diff --git a/tests/render/multiple-stage-io-locations.slang.1.expected b/tests/render/multiple-stage-io-locations.slang.1.expected new file mode 100644 index 000000000..4c32e2510 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.1.expected @@ -0,0 +1,5 @@ +result code = 0 +standard error = { +} +standard output = { +} diff --git a/tests/render/multiple-stage-io-locations.slang.1.expected.png b/tests/render/multiple-stage-io-locations.slang.1.expected.png Binary files differnew file mode 100644 index 000000000..3333a12d7 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.1.expected.png diff --git a/tests/render/multiple-stage-io-locations.slang.2.expected b/tests/render/multiple-stage-io-locations.slang.2.expected new file mode 100644 index 000000000..4c32e2510 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.2.expected @@ -0,0 +1,5 @@ +result code = 0 +standard error = { +} +standard output = { +} diff --git a/tests/render/multiple-stage-io-locations.slang.2.expected.png b/tests/render/multiple-stage-io-locations.slang.2.expected.png Binary files differnew file mode 100644 index 000000000..3333a12d7 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.2.expected.png diff --git a/tests/render/multiple-stage-io-locations.slang.expected b/tests/render/multiple-stage-io-locations.slang.expected new file mode 100644 index 000000000..4c32e2510 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.expected @@ -0,0 +1,5 @@ +result code = 0 +standard error = { +} +standard output = { +} diff --git a/tests/render/multiple-stage-io-locations.slang.expected.png b/tests/render/multiple-stage-io-locations.slang.expected.png Binary files differnew file mode 100644 index 000000000..3333a12d7 --- /dev/null +++ b/tests/render/multiple-stage-io-locations.slang.expected.png |
