OpenGL Renderer: Do some minor code cleanup.

This commit is contained in:
rogerman 2017-08-01 13:02:50 -07:00
parent fd5d882fe1
commit 600ae21668
2 changed files with 9 additions and 128 deletions

View File

@ -2127,26 +2127,8 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{
INFO("OpenGL: Failed to create FBOs!\n");
this->DestroyFBOs();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &OGLRef.fboClearImageID);
glDeleteFramebuffersEXT(1, &OGLRef.fboRenderID);
glDeleteFramebuffersEXT(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->isFBOSupported = false;
return OGLERROR_FBO_CREATE_ERROR;
}
@ -2171,26 +2153,8 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{
INFO("OpenGL: Failed to create FBOs!\n");
this->DestroyFBOs();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &OGLRef.fboClearImageID);
glDeleteFramebuffersEXT(1, &OGLRef.fboRenderID);
glDeleteFramebuffersEXT(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->isFBOSupported = false;
return OGLERROR_FBO_CREATE_ERROR;
}
@ -2213,26 +2177,8 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{
INFO("OpenGL: Failed to created FBOs!\n");
this->DestroyFBOs();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &OGLRef.fboClearImageID);
glDeleteFramebuffersEXT(1, &OGLRef.fboRenderID);
glDeleteFramebuffersEXT(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->isFBOSupported = false;
return OGLERROR_FBO_CREATE_ERROR;
}
@ -2314,13 +2260,7 @@ Render3DError OpenGLRenderer_1_2::CreateMultisampledFBO()
if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{
INFO("OpenGL: Failed to create multisampled FBO!\n");
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &OGLRef.fboMSIntermediateRenderID);
glDeleteRenderbuffersEXT(1, &OGLRef.rboMSGColorID);
glDeleteRenderbuffersEXT(1, &OGLRef.rboMSGPolyID);
glDeleteRenderbuffersEXT(1, &OGLRef.rboMSGFogAttrID);
glDeleteRenderbuffersEXT(1, &OGLRef.rboMSGDepthStencilID);
this->DestroyMultisampledFBO();
return OGLERROR_FBO_CREATE_ERROR;
}

View File

@ -906,24 +906,7 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
INFO("OpenGL: Failed to create FBOs!\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &OGLRef.fboClearImageID);
glDeleteFramebuffers(1, &OGLRef.fboRenderID);
glDeleteFramebuffers(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->DestroyFBOs();
return OGLERROR_FBO_CREATE_ERROR;
}
@ -940,24 +923,7 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
INFO("OpenGL: Failed to create FBOs!\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &OGLRef.fboClearImageID);
glDeleteFramebuffers(1, &OGLRef.fboRenderID);
glDeleteFramebuffers(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->DestroyFBOs();
return OGLERROR_FBO_CREATE_ERROR;
}
@ -973,24 +939,7 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
INFO("OpenGL: Failed to create FBOs!\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &OGLRef.fboClearImageID);
glDeleteFramebuffers(1, &OGLRef.fboRenderID);
glDeleteFramebuffers(1, &OGLRef.fboPostprocessID);
glDeleteTextures(1, &OGLRef.texCIColorID);
glDeleteTextures(1, &OGLRef.texCIFogAttrID);
glDeleteTextures(1, &OGLRef.texCIPolyID);
glDeleteTextures(1, &OGLRef.texCIDepthStencilID);
glDeleteTextures(1, &OGLRef.texGColorID);
glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0;
OGLRef.fboPostprocessID = 0;
this->DestroyFBOs();
return OGLERROR_FBO_CREATE_ERROR;
}
@ -1081,15 +1030,7 @@ Render3DError OpenGLRenderer_3_2::CreateMultisampledFBO()
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
INFO("OpenGL: Failed to create multisampled FBO. Multisample antialiasing will be disabled.\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &OGLRef.fboMSIntermediateRenderID);
glDeleteRenderbuffers(1, &OGLRef.rboMSGColorID);
glDeleteRenderbuffers(1, &OGLRef.rboMSGPolyID);
glDeleteRenderbuffers(1, &OGLRef.rboMSGFogAttrID);
glDeleteRenderbuffers(1, &OGLRef.rboMSGDepthStencilID);
OGLRef.fboMSIntermediateRenderID = 0;
this->DestroyMultisampledFBO();
return OGLERROR_FBO_CREATE_ERROR;
}
@ -1647,7 +1588,7 @@ Render3DError OpenGLRenderer_3_2::ClearUsingImage(const u16 *__restrict colorBuf
glBindFramebuffer(GL_FRAMEBUFFER, OGLRef.fboRenderID);
glDrawBuffers(3, RenderDrawList);
OGLRef.selectedRenderingFBO = (CommonSettings.GFX3D_Renderer_Multisample) ? OGLRef.fboMSIntermediateRenderID : OGLRef.fboRenderID;
OGLRef.selectedRenderingFBO = (CommonSettings.GFX3D_Renderer_Multisample && this->isMultisampledFBOSupported) ? OGLRef.fboMSIntermediateRenderID : OGLRef.fboRenderID;
if (OGLRef.selectedRenderingFBO == OGLRef.fboMSIntermediateRenderID)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, OGLRef.fboRenderID);