From 7ba2526fa8329b75d890f3fca8a4917e334e0284 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Sat, 18 Aug 2018 18:47:13 +0300 Subject: [PATCH] [D3D12] Move interpolators above position because it's more important for pixel shaders --- .../shaders/primitive_rectangle_list.gs.hlsl | 32 +++++++++---------- src/xenia/gpu/hlsl_shader_translator.cc | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/xenia/gpu/d3d12/shaders/primitive_rectangle_list.gs.hlsl b/src/xenia/gpu/d3d12/shaders/primitive_rectangle_list.gs.hlsl index 877c08093..1deb33c9d 100644 --- a/src/xenia/gpu/d3d12/shaders/primitive_rectangle_list.gs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/primitive_rectangle_list.gs.hlsl @@ -1,6 +1,6 @@ struct XeVertex { - float4 position : SV_Position; float4 interpolators[16] : TEXCOORD; + float4 position : SV_Position; float point_size : PSIZE; }; @@ -8,16 +8,16 @@ struct XeVertex { void main(triangle XeVertex xe_in[3], inout TriangleStream xe_stream) { XeVertex xe_out; - xe_out.position = xe_in[0].position; xe_out.interpolators = xe_in[0].interpolators; + xe_out.position = xe_in[0].position; xe_out.point_size = xe_in[0].point_size; xe_stream.Append(xe_out); - xe_out.position = xe_in[1].position; xe_out.interpolators = xe_in[1].interpolators; + xe_out.position = xe_in[1].position; xe_out.point_size = xe_in[1].point_size; xe_stream.Append(xe_out); - xe_out.position = xe_in[2].position; xe_out.interpolators = xe_in[2].interpolators; + xe_out.position = xe_in[2].position; xe_out.point_size = xe_in[2].point_size; xe_stream.Append(xe_out); xe_stream.RestartStrip(); @@ -38,46 +38,46 @@ void main(triangle XeVertex xe_in[3], inout TriangleStream xe_stream) // | // | 2: 1,-1 // | - | 3: [ 1, 1 ] // 1 ------[3] - xe_out.position = xe_in[2].position; xe_out.interpolators = xe_in[2].interpolators; + xe_out.position = xe_in[2].position; xe_out.point_size = xe_in[2].point_size; xe_stream.Append(xe_out); - xe_out.position = xe_in[1].position; xe_out.interpolators = xe_in[1].interpolators; + xe_out.position = xe_in[1].position; xe_out.point_size = xe_in[1].point_size; xe_stream.Append(xe_out); - xe_out.position = float4(xe_in[1].position.xy - - xe_in[0].position.xy + - xe_in[2].position.xy, - xe_in[2].position.zw); [unroll] for (int i = 0; i < 16; ++i) { xe_out.interpolators[i] = xe_in[1].interpolators[i] - xe_in[0].interpolators[i] + xe_in[2].interpolators[i]; } + xe_out.position = float4(xe_in[1].position.xy - + xe_in[0].position.xy + + xe_in[2].position.xy, + xe_in[2].position.zw); } else { // 0 ------ 1 0: -1,-1 // | - | 1: 1,-1 // | \\ | 2: 1, 1 // | - | 3: [-1, 1 ] // [3] ----- 2 - xe_out.position = xe_in[0].position; xe_out.interpolators = xe_in[0].interpolators; + xe_out.position = xe_in[0].position; xe_out.point_size = xe_in[0].point_size; xe_stream.Append(xe_out); - xe_out.position = xe_in[2].position; xe_out.interpolators = xe_in[2].interpolators; + xe_out.position = xe_in[2].position; xe_out.point_size = xe_in[2].point_size; xe_stream.Append(xe_out); - xe_out.position = float4(xe_in[0].position.xy - - xe_in[1].position.xy + - xe_in[2].position.xy, - xe_in[2].position.zw); [unroll] for (int i = 0; i < 16; ++i) { xe_out.interpolators[i] = xe_in[0].interpolators[i] - xe_in[1].interpolators[i] + xe_in[2].interpolators[i]; } + xe_out.position = float4(xe_in[0].position.xy - + xe_in[1].position.xy + + xe_in[2].position.xy, + xe_in[2].position.zw); } xe_out.point_size = xe_in[2].point_size; xe_stream.Append(xe_out); diff --git a/src/xenia/gpu/hlsl_shader_translator.cc b/src/xenia/gpu/hlsl_shader_translator.cc index cf8561dd8..34f1ca728 100644 --- a/src/xenia/gpu/hlsl_shader_translator.cc +++ b/src/xenia/gpu/hlsl_shader_translator.cc @@ -258,8 +258,8 @@ std::vector HlslShaderTranslator::CompleteTranslation() { "XE_BYTE_SWAP_OVERLOAD(uint4)\n" "\n" "struct XeVertexShaderOutput {\n" - " float4 position : SV_Position;\n" " float4 interpolators[%u] : TEXCOORD;\n" + " float4 position : SV_Position;\n" " float point_size : PSIZE;\n" "};\n" "\n" @@ -283,8 +283,8 @@ std::vector HlslShaderTranslator::CompleteTranslation() { // XE_PIXEL_SHADER_WRITES_DEPTH in the beginning of the final output. source.AppendFormat( "struct XePixelShaderInput {\n" - " float4 position : SV_Position;\n" " float4 interpolators[%u] : TEXCOORD;\n" + " float4 position : SV_Position;\n" "};\n" "\n" "struct XePixelShaderOutput {\n"