diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 946550598..fc0191b0a 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -483,6 +483,10 @@ gl_ctx gl; int screen_width; int screen_height; + +int currentScreenWidth = -1; +int currentScreenHeight = -1; + GLuint fogTextureId; GLFramebufferData fullscreenQuad; @@ -1634,15 +1638,16 @@ void fullscreenQuadCreateTemporaryFBO(float & screenToNativeXScale, float & scre // Generate and bind a render buffer which will become a depth buffer if (!fullscreenQuad.framebufferRenderbuffer) { glGenRenderbuffers(1, &fullscreenQuad.framebufferRenderbuffer); + } + if (currentScreenWidth != screen_width || currentScreenHeight != screen_height) { + glBindRenderbuffer(GL_RENDERBUFFER, fullscreenQuad.framebufferRenderbuffer); #ifdef GLES if (isExtensionSupported("GL_OES_packed_depth_stencil")) { glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, screen_width, screen_height); - } - else if (isExtensionSupported("GL_OES_depth24")) { + } else if (isExtensionSupported("GL_OES_depth24")) { glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24_OES, screen_width, screen_height); - } - else { + } else { glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, screen_width, screen_height); } #else @@ -1661,6 +1666,10 @@ void fullscreenQuadCreateTemporaryFBO(float & screenToNativeXScale, float & scre glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screen_width, screen_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); } + if (currentScreenWidth != screen_width || currentScreenHeight != screen_height) { + glBindTexture(GL_TEXTURE_2D, fullscreenQuad.framebufferTexture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screen_width, screen_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + } // Create the object that will allow us to render to the aforementioned texture (one for every rtt texture address) if (!fullscreenQuad.framebuffer) { @@ -2039,6 +2048,8 @@ bool RenderFrame() } else { fullscreenQuadCreateTemporaryFBO(screenToNativeXScale, screenToNativeYScale); + currentScreenWidth = screen_width; + currentScreenHeight = screen_height; } #endif } @@ -2089,7 +2100,7 @@ bool RenderFrame() printf("SCI: %f, %f, %f, %f\n", offs_x+pvrrc.fb_X_CLIP.min/scale_x,(pvrrc.fb_Y_CLIP.min/scale_y)*dc2s_scale_h,(pvrrc.fb_X_CLIP.max-pvrrc.fb_X_CLIP.min+1)/scale_x*dc2s_scale_h,(pvrrc.fb_Y_CLIP.max-pvrrc.fb_Y_CLIP.min+1)/scale_y*dc2s_scale_h); #endif - if (settings.rend.VerticalResolution == 100 && settings.rend.HorizontalResolution == 100) { + if (is_rtt || (settings.rend.VerticalResolution == 100 && settings.rend.HorizontalResolution == 100)) { if (settings.rend.WideScreen && pvrrc.fb_X_CLIP.min == 0 && ((pvrrc.fb_X_CLIP.max + 1) / scale_x == 640) && (pvrrc.fb_Y_CLIP.min == 0) && ((pvrrc.fb_Y_CLIP.max + 1) / scale_y == 480)) {