OpenGL Renderer: Remove a now defunct framebuffer texture, significantly reducing VRAM usage at the higher resolutions.

This commit is contained in:
rogerman 2018-12-04 21:49:09 -08:00
parent 3d573e150f
commit 355e4a0fb4
3 changed files with 0 additions and 30 deletions

View File

@ -2785,7 +2785,6 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
glGenTextures(1, &OGLRef.texGFogAttrID); glGenTextures(1, &OGLRef.texGFogAttrID);
glGenTextures(1, &OGLRef.texGPolyID); glGenTextures(1, &OGLRef.texGPolyID);
glGenTextures(1, &OGLRef.texGDepthStencilID); glGenTextures(1, &OGLRef.texGDepthStencilID);
glGenTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_DepthStencil); glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_DepthStencil);
glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilID); glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilID);
@ -2812,14 +2811,6 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_ZeroAlphaPixelMask);
glBindTexture(GL_TEXTURE_2D, OGLRef.texZeroAlphaPixelMaskID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr); glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr);
glBindTexture(GL_TEXTURE_2D, OGLRef.texGFogAttrID); glBindTexture(GL_TEXTURE_2D, OGLRef.texGFogAttrID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -2922,7 +2913,6 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, OGLRef.fboPostprocessID); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, OGLRef.fboPostprocessID);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, OGLRef.texGColorID, 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, OGLRef.texGColorID, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, OGLRef.texFinalColorID, 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, OGLRef.texFinalColorID, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, OGLRef.texZeroAlphaPixelMaskID, 0);
if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{ {
@ -2963,7 +2953,6 @@ void OpenGLRenderer_1_2::DestroyFBOs()
glDeleteTextures(1, &OGLRef.texGPolyID); glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID); glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID); glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0; OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0; OGLRef.fboRenderID = 0;
@ -5067,9 +5056,6 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GPolyID); glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GPolyID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_ZeroAlphaPixelMask);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr); glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
} }

View File

@ -297,7 +297,6 @@ enum OGLTextureUnitID
OGLTextureUnitID_GColor, OGLTextureUnitID_GColor,
OGLTextureUnitID_DepthStencil, OGLTextureUnitID_DepthStencil,
OGLTextureUnitID_GPolyID, OGLTextureUnitID_GPolyID,
OGLTextureUnitID_ZeroAlphaPixelMask,
OGLTextureUnitID_FogAttr, OGLTextureUnitID_FogAttr,
OGLTextureUnitID_PolyStates OGLTextureUnitID_PolyStates
}; };
@ -432,7 +431,6 @@ struct OGLRenderRef
GLuint texGColorID; GLuint texGColorID;
GLuint texGFogAttrID; GLuint texGFogAttrID;
GLuint texGPolyID; GLuint texGPolyID;
GLuint texZeroAlphaPixelMaskID;
GLuint texGDepthStencilID; GLuint texGDepthStencilID;
GLuint texFinalColorID; GLuint texFinalColorID;
GLuint texMSGColorID; GLuint texMSGColorID;

View File

@ -842,7 +842,6 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
glGenTextures(1, &OGLRef.texGFogAttrID); glGenTextures(1, &OGLRef.texGFogAttrID);
glGenTextures(1, &OGLRef.texGPolyID); glGenTextures(1, &OGLRef.texGPolyID);
glGenTextures(1, &OGLRef.texGDepthStencilID); glGenTextures(1, &OGLRef.texGDepthStencilID);
glGenTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_DepthStencil); glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_DepthStencil);
glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilID); glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilID);
@ -869,14 +868,6 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_ZeroAlphaPixelMask);
glBindTexture(GL_TEXTURE_2D, OGLRef.texZeroAlphaPixelMaskID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_framebufferWidth, this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr); glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr);
glBindTexture(GL_TEXTURE_2D, OGLRef.texGFogAttrID); glBindTexture(GL_TEXTURE_2D, OGLRef.texGFogAttrID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -961,7 +952,6 @@ Render3DError OpenGLRenderer_3_2::CreateFBOs()
glBindFramebuffer(GL_FRAMEBUFFER, OGLRef.fboPostprocessID); glBindFramebuffer(GL_FRAMEBUFFER, OGLRef.fboPostprocessID);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, OGLRef.texGColorID, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, OGLRef.texGColorID, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, OGLRef.texFinalColorID, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, OGLRef.texFinalColorID, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, OGLRef.texZeroAlphaPixelMaskID, 0);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{ {
@ -1002,7 +992,6 @@ void OpenGLRenderer_3_2::DestroyFBOs()
glDeleteTextures(1, &OGLRef.texGPolyID); glDeleteTextures(1, &OGLRef.texGPolyID);
glDeleteTextures(1, &OGLRef.texGFogAttrID); glDeleteTextures(1, &OGLRef.texGFogAttrID);
glDeleteTextures(1, &OGLRef.texGDepthStencilID); glDeleteTextures(1, &OGLRef.texGDepthStencilID);
glDeleteTextures(1, &OGLRef.texZeroAlphaPixelMaskID);
OGLRef.fboClearImageID = 0; OGLRef.fboClearImageID = 0;
OGLRef.fboRenderID = 0; OGLRef.fboRenderID = 0;
@ -2052,9 +2041,6 @@ Render3DError OpenGLRenderer_3_2::SetFramebufferSize(size_t w, size_t h)
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GPolyID); glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GPolyID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_ZeroAlphaPixelMask);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr); glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);