Permalink
Browse files

gsdx-ogl: Small colclip improvements.

1. Allow hrd colclip to also run on the unsupported
cases which should be pretty rare.

2. Remove colclip from high sw blending.

3. Disable the hdr colclip shader which may not be
actually required to run.

Idea by Gregory
  • Loading branch information...
lightningterror authored and gregory38 committed Jan 15, 2019
1 parent b5f0959 commit dabc99f466c00f8c09d62c3d21f4bf145a38d201
Showing with 8 additions and 7 deletions.
  1. +3 −2 plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp
  2. +5 −5 plugins/GSdx/res/glsl/tfx_fs.glsl
@@ -561,7 +561,7 @@ void GSRendererOGL::EmulateBlending(bool DATE_GL42)
sw_blending |= (ALPHA.A != ALPHA.B) &&
((ALPHA.C == 0 && m_vt.m_alpha.max > 128) || (ALPHA.C == 2 && ALPHA.FIX > 128u));
// fall through
case ACC_BLEND_CCLIP_DALPHA: sw_blending |= (ALPHA.C == 1) || (m_env.COLCLAMP.CLAMP == 0);
case ACC_BLEND_CCLIP_DALPHA: sw_blending |= (ALPHA.C == 1);
// Initial idea was to enable accurate blending for sprite rendering to handle
// correctly post-processing effect. Some games (ZoE) use tons of sprites as particles.
// In order to keep it fast, let's limit it to smaller draw call.
@@ -598,7 +598,8 @@ void GSRendererOGL::EmulateBlending(bool DATE_GL42)
m_ps_sel.colclip = 1;
} else {
// Speed hack skip previous slow algo
GL_INS("Sorry colclip isn't supported");
GL_INS("COLCLIP HDR Rare case ENABLED");
m_ps_sel.hdr = 1;
}
}

@@ -837,15 +837,15 @@ void ps_main()

ps_fbmask(C);

#if PS_HDR == 1
// #if PS_HDR == 1
// Use negative value to avoid overflow of the texture (in accumulation mode)
// Note: code were initially done for an Half-Float texture. Due to overflow
// the texture was upgraded to a full float. Maybe this code is useless now!
// Good testcase is castlevania
if (any(greaterThan(C.rgb, vec3(128.0f)))) {
C.rgb = (C.rgb - 256.0f);
}
#endif
// if (any(greaterThan(C.rgb, vec3(128.0f)))) {
// C.rgb = (C.rgb - 256.0f);
// }
// #endif
SV_Target0 = C / 255.0f;
SV_Target1 = vec4(alpha_blend);
}

0 comments on commit dabc99f

Please sign in to comment.