diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/global-type-param-in-entrypoint.slang | 96 | ||||
| -rw-r--r-- | tests/compute/global-type-param-in-entrypoint.slang.expected.txt | 4 |
2 files changed, 100 insertions, 0 deletions
diff --git a/tests/compute/global-type-param-in-entrypoint.slang b/tests/compute/global-type-param-in-entrypoint.slang new file mode 100644 index 000000000..5d8036d98 --- /dev/null +++ b/tests/compute/global-type-param-in-entrypoint.slang @@ -0,0 +1,96 @@ +//TEST(compute):COMPARE_RENDER_COMPUTE:-xslang -use-ir +//TEST_INPUT: cbuffer(data=[1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0], stride=16):dxbinding(0),glbinding(0) +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):dxbinding(1),glbinding(0),out +//TEST_INPUT: type VertImpl + +interface IVertInterpolant +{ + float4 getColor(); +} + +__generic_param TVertInterpolant : IVertInterpolant; + +struct VertImpl : IVertInterpolant +{ + float3 color; + float4 getColor() + { + return float4(1.0); + } +}; + +RWStructuredBuffer<float> outputBuffer; + +cbuffer Uniforms +{ + float4x4 modelViewProjection; +} + +struct AssembledVertex +{ + float3 position; + TVertInterpolant interpolants; + float2 uv; +}; + +struct CoarseVertex +{ + TVertInterpolant interpolants; + float2 uv; +}; + +struct Fragment +{ + float4 color; +}; + + +// Vertex Shader + +struct VertexStageInput +{ + AssembledVertex assembledVertex : A; +}; + +struct VertexStageOutput +{ + CoarseVertex coarseVertex : CoarseVertex; + float4 sv_position : SV_Position; +}; + +VertexStageOutput vertexMain(VertexStageInput input) +{ + VertexStageOutput output; + + float3 position = input.assembledVertex.position; + output.coarseVertex.interpolants = input.assembledVertex.interpolants; + output.sv_position = mul(modelViewProjection, float4(position, 1.0)); + output.coarseVertex.uv = input.assembledVertex.uv; + return output; +} + +// Fragment Shader + +struct FragmentStageInput +{ + CoarseVertex coarseVertex : CoarseVertex; +}; + +struct FragmentStageOutput +{ + Fragment fragment : SV_Target; +}; + +FragmentStageOutput fragmentMain(FragmentStageInput input) +{ + FragmentStageOutput output; + + float4 color = input.coarseVertex.interpolants.getColor(); + float2 uv = input.coarseVertex.uv; + output.fragment.color = color; + outputBuffer[0] = color.x; + outputBuffer[1] = color.y; + outputBuffer[2] = color.z; + outputBuffer[3] = color.w; + return output; +}
\ No newline at end of file diff --git a/tests/compute/global-type-param-in-entrypoint.slang.expected.txt b/tests/compute/global-type-param-in-entrypoint.slang.expected.txt new file mode 100644 index 000000000..e143b7f20 --- /dev/null +++ b/tests/compute/global-type-param-in-entrypoint.slang.expected.txt @@ -0,0 +1,4 @@ +3F800000 +3F800000 +3F800000 +3F800000
\ No newline at end of file |
