From 3a7a08f3fbbd0ef6d84adeddb125ec1f23953339 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 2 Aug 2018 17:20:18 +0200 Subject: [PATCH] Do not clear the framebuffer before rendering. Fix scissoring coords. The framebuffer is cleared by the background plane using global clipping coordinates. This allows multiple rendering to different locations on the framebuffer. Fixes flashing menus in Vanishing Point, loading screens in Test Drive Le Mans and Vigilante 8. Better rear view mirror in Metropolis Street Racer. --- core/rend/gles/gles.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 1f9e0c9a0..80eaea832 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -1557,11 +1557,11 @@ bool RenderFrame() scissoring_scale_x = 0.5f; scale_x *= 0.5f; } - } - if (SCALER_CTL.hscale) - { - scale_x*=2; + if (SCALER_CTL.hscale) + { + scale_x*=2; + } } dc_width *= scale_x; @@ -1715,18 +1715,14 @@ bool RenderFrame() && pvrrc.fb_Y_CLIP.min == 0 && (pvrrc.fb_Y_CLIP.max + 1) / scale_y == 480; - //Color is cleared by the bgp - if (wide_screen_on) - glcache.ClearColor(pvrrc.verts.head()->col[2]/255.0f,pvrrc.verts.head()->col[1]/255.0f,pvrrc.verts.head()->col[0]/255.0f,1.0f); - else - glcache.ClearColor(0,0,0,1.0f); + //Color is cleared by the background plane glcache.Disable(GL_SCISSOR_TEST); glcache.DepthMask(GL_TRUE); glClearDepthf(0.0); glStencilMask(0xFF); glCheck(); - glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCheck(); + glClear(GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCheck(); //move vertex to gpu @@ -1762,14 +1758,14 @@ bool RenderFrame() { float width = (pvrrc.fb_X_CLIP.max - pvrrc.fb_X_CLIP.min + 1) / scale_x; float height = (pvrrc.fb_Y_CLIP.max - pvrrc.fb_Y_CLIP.min + 1) / scale_y; - int min_x = pvrrc.fb_X_CLIP.min / scale_x; - int min_y = pvrrc.fb_Y_CLIP.min / scale_y; + float min_x = pvrrc.fb_X_CLIP.min / scale_x; + float min_y = pvrrc.fb_Y_CLIP.min / scale_y; if (!is_rtt) { // Add x offset for aspect ratio > 4/3 min_x = min_x * dc2s_scale_h + offs_x; // Invert y coordinates when rendering to screen - min_y = screen_height - height * dc2s_scale_h; + min_y = screen_height - (min_y + height) * dc2s_scale_h; width *= dc2s_scale_h; height *= dc2s_scale_h; }