From 5447da058857fc340b0a030c9fc61d7a3b60cf2d Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 16 Aug 2022 11:27:06 +0100 Subject: [PATCH] GS: Don't do blend_mix on HDR --- bin/resources/shaders/dx11/tfx.fx | 2 +- bin/resources/shaders/opengl/tfx_fs.glsl | 2 +- bin/resources/shaders/vulkan/tfx.glsl | 2 +- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 1 + pcsx2/GS/Renderers/Metal/tfx.metal | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/resources/shaders/dx11/tfx.fx b/bin/resources/shaders/dx11/tfx.fx index 9babd0e450..e699e2d864 100644 --- a/bin/resources/shaders/dx11/tfx.fx +++ b/bin/resources/shaders/dx11/tfx.fx @@ -743,7 +743,7 @@ void ps_color_clamp_wrap(inout float3 C) C = clamp(C, (float3)0.0f, (float3)255.0f); // In 16 bits format, only 5 bits of color are used. It impacts shadows computation of Castlevania - if (PS_DFMT == FMT_16 && (PS_HDR == 1 || PS_BLEND_MIX == 0)) + if (PS_DFMT == FMT_16 && PS_BLEND_MIX == 0) C = (float3)((int3)C & (int3)0xF8); else if (PS_COLCLIP == 1 && PS_HDR == 0) C = (float3)((int3)C & (int3)0xFF); diff --git a/bin/resources/shaders/opengl/tfx_fs.glsl b/bin/resources/shaders/opengl/tfx_fs.glsl index b27aa0acf7..a552b0fa85 100644 --- a/bin/resources/shaders/opengl/tfx_fs.glsl +++ b/bin/resources/shaders/opengl/tfx_fs.glsl @@ -679,7 +679,7 @@ void ps_color_clamp_wrap(inout vec3 C) // Warning: normally blending equation is mult(A, B) = A * B >> 7. GPU have the full accuracy // GS: Color = 1, Alpha = 255 => output 1 // GPU: Color = 1/255, Alpha = 255/255 * 255/128 => output 1.9921875 -#if PS_DFMT == FMT_16 && (PS_HDR == 1 || PS_BLEND_MIX == 0) +#if PS_DFMT == FMT_16 && PS_BLEND_MIX == 0 // In 16 bits format, only 5 bits of colors are used. It impacts shadows computation of Castlevania C = vec3(ivec3(C) & ivec3(0xF8)); #elif PS_COLCLIP == 1 && PS_HDR == 0 diff --git a/bin/resources/shaders/vulkan/tfx.glsl b/bin/resources/shaders/vulkan/tfx.glsl index ff8c87e7f6..72fe16bc63 100644 --- a/bin/resources/shaders/vulkan/tfx.glsl +++ b/bin/resources/shaders/vulkan/tfx.glsl @@ -980,7 +980,7 @@ void ps_color_clamp_wrap(inout vec3 C) // Warning: normally blending equation is mult(A, B) = A * B >> 7. GPU have the full accuracy // GS: Color = 1, Alpha = 255 => output 1 // GPU: Color = 1/255, Alpha = 255/255 * 255/128 => output 1.9921875 -#if PS_DFMT == FMT_16 && (PS_HDR == 1 || PS_BLEND_MIX == 0) +#if PS_DFMT == FMT_16 && PS_BLEND_MIX == 0 // In 16 bits format, only 5 bits of colors are used. It impacts shadows computation of Castlevania C = vec3(ivec3(C) & ivec3(0xF8)); #elif PS_COLCLIP == 1 && PS_HDR == 0 diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index eb2d3813f4..27e6b176a9 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -2612,6 +2612,7 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool& // A fast algo that requires 2 passes GL_INS("COLCLIP Fast HDR mode ENABLED"); m_conf.ps.hdr = 1; + blend_mix = false; sw_blending = true; // Enable sw blending for the HDR algo } else if (sw_blending) diff --git a/pcsx2/GS/Renderers/Metal/tfx.metal b/pcsx2/GS/Renderers/Metal/tfx.metal index 5443517964..bf6fd9ff39 100644 --- a/pcsx2/GS/Renderers/Metal/tfx.metal +++ b/pcsx2/GS/Renderers/Metal/tfx.metal @@ -708,7 +708,7 @@ struct PSMain // Warning: normally blending equation is mult(A, B) = A * B >> 7. GPU have the full accuracy // GS: Color = 1, Alpha = 255 => output 1 // GPU: Color = 1/255, Alpha = 255/255 * 255/128 => output 1.9921875 - if (PS_DFMT == FMT_16 && (PS_HDR || PS_BLEND_MIX == 0)) + if (PS_DFMT == FMT_16 && PS_BLEND_MIX == 0) // In 16 bits format, only 5 bits of colors are used. It impacts shadows computation of Castlevania C.rgb = float3(short3(C.rgb) & 0xF8); else if (PS_COLCLIP && !PS_HDR)