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/TextureConversionShader.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/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConversionShader.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index ef2e4eb076..8a2588908c 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -180,21 +180,33 @@ static void WriteSampleFunction(char*& p, const EFBCopyParams& params, APIType A // The filter is only applied to the RGB channels, the alpha channel is left intact. WRITE(p, "float4 SampleEFB(float2 uv, float2 pixel_size, int xoffset)\n"); WRITE(p, "{\n"); - WRITE(p, " float4 prev_row = "); - WriteSampleOp(-1); - WRITE(p, ";\n"); - WRITE(p, " float4 current_row = "); - WriteSampleOp(0); - WRITE(p, ";\n"); - WRITE(p, " float4 next_row = "); - WriteSampleOp(1); - WRITE(p, ";\n"); - WRITE(p, + if (params.copy_filter) + { + WRITE(p, " float4 prev_row = "); + WriteSampleOp(-1); + WRITE(p, ";\n"); + WRITE(p, " float4 current_row = "); + WriteSampleOp(0); + WRITE(p, ";\n"); + WRITE(p, " float4 next_row = "); + WriteSampleOp(1); + WRITE(p, ";\n"); + WRITE( + p, " float3 col = float3(clamp((int3(prev_row.rgb * 255.0) * filter_coefficients[0] +\n" " int3(current_row.rgb * 255.0) * filter_coefficients[1] +\n" " int3(next_row.rgb * 255.0) * filter_coefficients[2]) >> 6,\n" " int3(0, 0, 0), int3(255, 255, 255))) / 255.0;\n"); - WRITE(p, " return float4(col, current_row.a);\n"); + WRITE(p, " return float4(col, current_row.a);\n"); + } + else + { + WRITE(p, " float4 current_row = "); + WriteSampleOp(0); + WRITE(p, ";\n"); + WRITE(p, " return float4(clamp(int3(current_row.rgb * 255.0) * filter_coefficients[1], " + "int3(0, 0, 0), int3(255, 255, 255)), current_row.a);\n"); + } WRITE(p, "}\n"); } |
