Skip to content

Commit

Permalink
GS-hw: Don't wrap on 16bit destination format for blend mix.
Browse files Browse the repository at this point in the history
Helps Dog's Life blending, we shouldn't wrap as we do more blend math afterward which will be wrong if we wrapped before.
  • Loading branch information
lightningterror committed Feb 18, 2022
1 parent 7151848 commit 06766dd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/resources/shaders/dx11/tfx.fx
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,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)
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);
Expand Down
2 changes: 1 addition & 1 deletion bin/resources/shaders/opengl/tfx_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,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
#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
Expand Down
2 changes: 1 addition & 1 deletion bin/resources/shaders/vulkan/tfx.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,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
#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
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/Renderers/HW/GSRendererNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER)
accumulation_blend = false;
blend_mix = false;
}
else if (accumulation_blend || blend_mix)
else if (accumulation_blend)
{
// A fast algo that requires 2 passes
GL_INS("COLCLIP Fast HDR mode ENABLED");
Expand Down

0 comments on commit 06766dd

Please sign in to comment.