diff options
| author | Stenzek <stenzek@users.noreply.github.com> | 2018-05-22 13:52:26 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-22 13:52:26 +1000 |
| commit | 7eaba154a41c72826d4c660753386421f21336d7 (patch) | |
| tree | d47658663579320c3ec9cbf1e4432ff5d07877af /Source/Core/VideoCommon/TextureConversionShader.cpp | |
| parent | f64bd401b692fae42dbc3894d5213b55f5517fdd (diff) | |
| parent | f74dbc794c124e6f1c5d5f60ff1d6fe65acc379f (diff) | |
Merge pull request #6936 from stenzek/copy-filter-depth-fix
EFB2RAM: Apply copy filter as a float coefficient after sampling
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConversionShader.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 8a2588908c..e57cbdf603 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -67,7 +67,7 @@ static void WriteHeader(char*& p, APIType ApiType) WRITE(p, "uniform float y_scale;\n"); WRITE(p, "uniform float gamma_rcp;\n"); WRITE(p, "uniform float2 clamp_tb;\n"); - WRITE(p, "uniform int3 filter_coefficients;\n"); + WRITE(p, "uniform float3 filter_coefficients;\n"); WRITE(p, "#define samp0 samp9\n"); WRITE(p, "SAMPLER_BINDING(9) uniform sampler2DArray samp0;\n"); WRITE(p, "FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n"); @@ -79,7 +79,7 @@ static void WriteHeader(char*& p, APIType ApiType) WRITE(p, " float y_scale;\n"); WRITE(p, " float gamma_rcp;\n"); WRITE(p, " float2 clamp_tb;\n"); - WRITE(p, " int3 filter_coefficients;\n"); + WRITE(p, " float3 filter_coefficients;\n"); WRITE(p, "};\n"); WRITE(p, "SAMPLER_BINDING(0) uniform sampler2DArray samp0;\n"); WRITE(p, "FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n"); @@ -91,7 +91,7 @@ static void WriteHeader(char*& p, APIType ApiType) WRITE(p, " float y_scale;\n"); WRITE(p, " float gamma_rcp;\n"); WRITE(p, " float2 clamp_tb;\n"); - WRITE(p, " int3 filter_coefficients;\n"); + WRITE(p, " float3 filter_coefficients;\n"); WRITE(p, "};\n"); WRITE(p, "sampler samp0 : register(s0);\n"); WRITE(p, "Texture2DArray Tex0 : register(t0);\n"); @@ -191,21 +191,18 @@ static void WriteSampleFunction(char*& p, const EFBCopyParams& params, APIType A 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(min(prev_row.rgb * filter_coefficients[0] +\n" + " current_row.rgb * filter_coefficients[1] +\n" + " next_row.rgb * filter_coefficients[2], \n" + " float3(1, 1, 1)), 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, "return float4(min(current_row.rgb * filter_coefficients[1], float3(1, 1, 1)),\n" + " current_row.a);\n"); } WRITE(p, "}\n"); } @@ -1422,4 +1419,4 @@ std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_form return ss.str(); } -} // namespace +} // namespace TextureConversionShaderTiled |
