From d5776879de579d84541316ef975eb2e7348d6cdf Mon Sep 17 00:00:00 2001 From: Gordon-F Date: Mon, 5 Jul 2021 13:54:42 +0300 Subject: [PATCH] [hlsl-out] Enable interface snapshot testing --- tests/out/hlsl/interface.hlsl | 51 ++++++++++++++++++++++++++++ tests/out/hlsl/interface.hlsl.config | 6 ++++ tests/snapshots.rs | 5 ++- 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/out/hlsl/interface.hlsl create mode 100644 tests/out/hlsl/interface.hlsl.config diff --git a/tests/out/hlsl/interface.hlsl b/tests/out/hlsl/interface.hlsl new file mode 100644 index 0000000000..6dc852d5f0 --- /dev/null +++ b/tests/out/hlsl/interface.hlsl @@ -0,0 +1,51 @@ +struct VertexOutput { + float4 position : SV_Position; + float varying : LOC1; +}; + +struct FragmentOutput { + float depth : SV_Depth; + uint sample_mask : SV_Coverage; + float color : SV_Target0; +}; + +struct VertexInput_vertex { + uint vertex_index1 : SV_VertexID; + uint instance_index1 : SV_InstanceID; + uint color1 : LOC10; +}; + +struct FragmentInput_fragment { + VertexOutput in2; + bool front_facing1 : SV_IsFrontFace; + uint sample_index1 : SV_SampleIndex; + uint sample_mask1 : SV_Coverage; +}; + +struct ComputeInput_compute { + uint3 global_id1 : SV_DispatchThreadID; + uint3 local_id1 : SV_GroupThreadID; + uint local_index1 : SV_GroupIndex; + uint3 wg_id1 : SV_GroupID; +}; + +VertexOutput vertex(VertexInput_vertex vertexinput_vertex) +{ + uint tmp = ((vertexinput_vertex.vertex_index1 + vertexinput_vertex.instance_index1) + vertexinput_vertex.color1); + const VertexOutput vertexoutput1 = { float4(1.0.xxxx), float(tmp) }; + return vertexoutput1; +} + +FragmentOutput fragment(FragmentInput_fragment fragmentinput_fragment) +{ + uint mask = (fragmentinput_fragment.sample_mask1 & (1u << fragmentinput_fragment.sample_index1)); + float color2 = (fragmentinput_fragment.front_facing1 ? 0.0 : 1.0); + const FragmentOutput fragmentoutput1 = { fragmentinput_fragment.in2.varying, mask, color2 }; + return fragmentoutput1; +} + +[numthreads(1, 1, 1)] +void compute(ComputeInput_compute computeinput_compute) +{ + return; +} diff --git a/tests/out/hlsl/interface.hlsl.config b/tests/out/hlsl/interface.hlsl.config new file mode 100644 index 0000000000..bd33fe9c2c --- /dev/null +++ b/tests/out/hlsl/interface.hlsl.config @@ -0,0 +1,6 @@ +vertex=vs_5_0 +vertex_name=vertex +fragment=ps_5_0 +fragment_name=fragment +compute=cs_5_0 +compute_name=compute diff --git a/tests/snapshots.rs b/tests/snapshots.rs index b4950547c5..c886d57efc 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -374,7 +374,10 @@ fn convert_wgsl() { Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, ), //TODO: GLSL https://github.com/gfx-rs/naga/issues/874 - ("interface", Targets::SPIRV | Targets::METAL | Targets::WGSL), + ( + "interface", + Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, + ), ( "globals", Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL,