Fixed multiple issues with the postprocessing shaders.

This commit is contained in:
Leon Styhre 2023-02-21 18:41:35 +01:00
parent b335901ee6
commit a6b95fdea4

View file

@ -664,16 +664,19 @@ void RendererOpenGL::shaderPostprocessing(unsigned int shaders,
mTrans = getProjectionMatrixNormal() * getIdentity(); mTrans = getProjectionMatrixNormal() * getIdentity();
} }
else { else {
if ((shaderCalls + (textureRGBA ? 1 : 0)) % 2 == 0) if ((shaderCalls + (textureRGBA ? 1 : 0)) % 2 == 0 && !(textureRGBA && shaderCalls == 1))
GL_CHECK_ERROR(glBlitFramebuffer(0, 0, width + mPaddingWidth, height - mScreenOffsetY, GL_CHECK_ERROR(glBlitFramebuffer(0, 0, width + mPaddingWidth, height - mScreenOffsetY,
-mScreenOffsetX - mPaddingWidth, mScreenOffsetY, -mScreenOffsetX - mPaddingWidth, mScreenOffsetY,
width - mScreenOffsetX, height, GL_COLOR_BUFFER_BIT, width - mScreenOffsetX, height, GL_COLOR_BUFFER_BIT,
GL_NEAREST)); GL_NEAREST));
else else
GL_CHECK_ERROR(glBlitFramebuffer( GL_CHECK_ERROR(glBlitFramebuffer(0, 0, width + mPaddingWidth, height - mScreenOffsetY,
0, 0, width + mPaddingWidth, height + (mPaddingHeight / 2), width + mScreenOffsetX + mPaddingWidth,
width + mScreenOffsetX + mPaddingWidth, height - mScreenOffsetY, mScreenOffsetX, height - mScreenOffsetY, mScreenOffsetX, 0,
-(mPaddingHeight / 2) - mScreenOffsetY, GL_COLOR_BUFFER_BIT, GL_NEAREST)); GL_COLOR_BUFFER_BIT, GL_NEAREST));
// For correct rendering if the blurred background is disabled when opening menus.
if (textureRGBA && shaderCalls == 1)
mTrans = getProjectionMatrixNormal() * getIdentity();
} }
if (shaderCalls > 1) if (shaderCalls > 1)
@ -704,6 +707,9 @@ void RendererOpenGL::shaderPostprocessing(unsigned int shaders,
drawTriangleStrips(vertices, 4, BlendFactor::SRC_ALPHA, drawTriangleStrips(vertices, 4, BlendFactor::SRC_ALPHA,
BlendFactor::ONE_MINUS_SRC_ALPHA); BlendFactor::ONE_MINUS_SRC_ALPHA);
if (shaderCalls == 1)
break;
if (firstFBO) { if (firstFBO) {
bindTexture(mPostProcTexture2); bindTexture(mPostProcTexture2);
GL_CHECK_ERROR(glBindFramebuffer(GL_READ_FRAMEBUFFER, mShaderFBO2)); GL_CHECK_ERROR(glBindFramebuffer(GL_READ_FRAMEBUFFER, mShaderFBO2));