diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2018-05-17 10:45:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 10:45:50 +0200 |
| commit | c485efdfe1730d54dbbe2150378cb7b02b3d435c (patch) | |
| tree | 528e08f39193e8ff7cb8662e72d7d21896589e50 /Source/Core/VideoCommon/TextureConverterShaderGen.cpp | |
| parent | 6ed3f8b474be5555b196e1b7f240cbfa778d0d8d (diff) | |
| parent | 4faac3a6270c288dad57a59ee0f821512846ebfb (diff) | |
Merge pull request #6743 from stenzek/faster-disabled-copy-filter
TextureConversionShader: Don't sample from adjacent rows when not needed
Diffstat (limited to 'Source/Core/VideoCommon/TextureConverterShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConverterShaderGen.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
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<UidData>(); @@ -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) { |
