Skip to content

Commit

Permalink
gsdx-ogl: Small colclip improvements.
Browse files Browse the repository at this point in the history
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 Feb 8, 2019
1 parent b5f0959 commit dabc99f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}

Expand Down
10 changes: 5 additions & 5 deletions plugins/GSdx/res/glsl/tfx_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit dabc99f

Please sign in to comment.