diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index 439ad8b1f..c73675c10 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -171,6 +171,8 @@ __forceinline else ShaderUniforms.trilinear_alpha = 1.0; + bool color_clamp = gp->tsp.ColorClamp && (pvrrc.fog_clamp_min != 0 || pvrrc.fog_clamp_max != 0xffffffff); + CurrentShader = &gl.pogram_table[ GetProgramID(Type == ListType_Punch_Through ? 1 : 0, SetTileClip(gp->tileclip, false) + 1, @@ -182,7 +184,7 @@ __forceinline gp->tsp.FogCtrl, gp->pcw.Gouraud, gp->tcw.PixelFmt == PixelBumpMap, - pvrrc.fog_clamp_min != 0 || pvrrc.fog_clamp_max != 0xffffffff)]; + color_clamp)]; if (CurrentShader->program == -1) CompilePipelineShader(CurrentShader); diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 0c1037103..b645e370b 100644 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -330,21 +330,24 @@ void main() \n\ #if pp_Offset==1 && pp_BumpMap == 0 \n\ { \n\ color.rgb+=vtx_offs.rgb; \n\ - if (pp_FogCtrl==1) \n\ - { \n\ - color = fog_clamp(color); \n\ - color.rgb=mix(color.rgb,sp_FOG_COL_VERT.rgb,vtx_offs.a); \n\ - } \n\ } \n\ #endif\n\ } \n\ #endif\n\ - #if pp_FogCtrl==0 \n\ + \n\ + color = fog_clamp(color); \n\ + \n\ + #if pp_FogCtrl == 0 \n\ { \n\ - color = fog_clamp(color); \n\ color.rgb=mix(color.rgb,sp_FOG_COL_RAM.rgb,fog_mode2(gl_FragCoord.w)); \n\ } \n\ #endif\n\ + #if pp_FogCtrl == 1 && pp_Offset==1 && pp_BumpMap == 0 \n\ + { \n\ + color.rgb=mix(color.rgb,sp_FOG_COL_VERT.rgb,vtx_offs.a); \n\ + } \n\ + #endif\n\ + \n\ color *= trilinear_alpha; \n\ \n\ #if cp_AlphaTest == 1 \n\