From 4faac3a6270c288dad57a59ee0f821512846ebfb Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 3 May 2018 14:09:32 +1000 Subject: TextureConversionShader: Don't sample from adjacent rows when not needed --- .../Core/VideoCommon/TextureConverterShaderGen.cpp | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/TextureConverterShaderGen.cpp') diff --git a/Source/Core/VideoCommon/TextureConverterShaderGen.cpp b/Source/Core/VideoCommon/TextureConverterShaderGen.cpp index 8a3c3970d8..748afa29b6 100644 --- a/Source/Core/VideoCommon/TextureConverterShaderGen.cpp +++ b/Source/Core/VideoCommon/TextureConverterShaderGen.cpp @@ -15,7 +15,7 @@ namespace TextureConversionShaderGen { TCShaderUid GetShaderUid(EFBCopyFormat dst_format, bool is_depth_copy, bool is_intensity, - bool scale_by_half) + bool scale_by_half, bool copy_filter) { TCShaderUid out; UidData* uid_data = out.GetUidData(); @@ -26,6 +26,7 @@ TCShaderUid GetShaderUid(EFBCopyFormat dst_format, bool is_depth_copy, bool is_i uid_data->is_depth_copy = is_depth_copy; uid_data->is_intensity = is_intensity; uid_data->scale_by_half = scale_by_half; + uid_data->copy_filter = copy_filter; return out; } @@ -91,12 +92,21 @@ ShaderCode GenerateShader(APIType api_type, const UidData* uid_data) // The copy filter applies to both color and depth copies. This has been verified on hardware. // The filter is only applied to the RGB channels, the alpha channel is left intact. - out.Write(" float4 prev_row = SampleEFB(uv0, -1.0f);\n" - " float4 current_row = SampleEFB(uv0, 0.0f);\n" - " float4 next_row = SampleEFB(uv0, 1.0f);\n" - " float4 texcol = float4(prev_row.rgb * filter_coefficients[0] +\n" - " current_row.rgb * filter_coefficients[1] +\n" - " next_row.rgb * filter_coefficients[2], current_row.a);\n"); + if (uid_data->copy_filter) + { + out.Write(" float4 prev_row = SampleEFB(uv0, -1.0f);\n" + " float4 current_row = SampleEFB(uv0, 0.0f);\n" + " float4 next_row = SampleEFB(uv0, 1.0f);\n" + " float4 texcol = float4(prev_row.rgb * filter_coefficients[0] +\n" + " current_row.rgb * filter_coefficients[1] +\n" + " next_row.rgb * filter_coefficients[2], current_row.a);\n"); + } + else + { + out.Write( + " float4 current_row = SampleEFB(uv0, 0.0f);\n" + " float4 texcol = float4(current_row.rgb * filter_coefficients[1], current_row.a);\n"); + } if (uid_data->is_depth_copy) { -- cgit v1.2.3