diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index 01483b2c1..dd99fd2b3 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -68,9 +68,6 @@ const static u32 SrcBlendGL[] = GL_ONE_MINUS_DST_ALPHA }; -extern int screen_width; -extern int screen_height; - PipelineShader* CurrentShader; u32 gcflip; @@ -102,24 +99,8 @@ s32 SetTileClip(u32 val, bool set) if (csx <= 0 && csy <= 0 && cex >= 640 && cey >= 480) return 0; - if (set && clip_mode) { - csx *= scale_x; - csy *= scale_y; - cex *= scale_x; - cey *= scale_y; - if (!pvrrc.isRTT) { - float t = cey; - cey = 480 - csy; - csy = 480 - t; - float dc2s_scale_h = screen_height / 480.0f; - float ds2s_offs_x = (screen_width - dc2s_scale_h * 640) / 2; - csx = csx * dc2s_scale_h + ds2s_offs_x; - cex = cex * dc2s_scale_h + ds2s_offs_x; - csy = csy * dc2s_scale_h; - cey = cey * dc2s_scale_h; - } + if (set) glUniform4f(CurrentShader->pp_ClipTest, csx, csy, cex, cey); - } return clip_mode; } diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index c7817896e..bd28f3454 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -271,14 +271,14 @@ void main() \n\ { \n\ // Clip outside the box \n\ #if pp_ClipTestMode==1 \n\ - if (gl_FragCoord.x < pp_ClipTest.x || gl_FragCoord.x > pp_ClipTest.z \n\ - || gl_FragCoord.y < pp_ClipTest.y || gl_FragCoord.y > pp_ClipTest.w) \n\ + if (vtx_xyz.x < pp_ClipTest.x || vtx_xyz.x > pp_ClipTest.z \n\ + || vtx_xyz.y < pp_ClipTest.y || vtx_xyz.y > pp_ClipTest.w) \n\ discard; \n\ #endif \n\ // Clip inside the box \n\ #if pp_ClipTestMode==-1 \n\ - if (gl_FragCoord.x >= pp_ClipTest.x && gl_FragCoord.x <= pp_ClipTest.z \n\ - && gl_FragCoord.y >= pp_ClipTest.y && gl_FragCoord.y <= pp_ClipTest.w) \n\ + if (vtx_xyz.x >= pp_ClipTest.x && vtx_xyz.x <= pp_ClipTest.z \n\ + && vtx_xyz.y >= pp_ClipTest.y && vtx_xyz.y <= pp_ClipTest.w) \n\ discard; \n\ #endif \n\ \n\