more changes to FBO stuff
now it wont ever do anything when disabled also properly deletes the FBO when disabling it
This commit is contained in:
1 parent
23734480cc
commit
d82886c517
4 files changed
+36
-19
No files matched your search
@@ -1022,14 +1022,11 @@ void GLFramebuffer_Generate(void)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
}
|
||||
|
||||
void GLFramebuffer_Delete(void)
|
||||
static void GLFramebuffer_Delete(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
if (FramebufferObject)
|
||||
pglDeleteFramebuffers(1, &FramebufferObject);
|
||||
|
||||
@@ -1085,6 +1082,7 @@ void GLFramebuffer_DeleteAttachments(void)
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
if (FramebufferTexture)
|
||||
pglDeleteTextures(1, &FramebufferTexture);
|
||||
@@ -1096,6 +1094,15 @@ void GLFramebuffer_DeleteAttachments(void)
|
||||
RenderbufferObject = 0;
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Unbind(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Enable(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
@@ -1110,13 +1117,15 @@ inline void GLFramebuffer_Enable(void)
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Disable(void)
|
||||
void GLFramebuffer_Disable(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
GLFramebuffer_Delete();
|
||||
}
|
||||
#endif
|
||||
// -----------------+
|
||||
|
||||
@@ -106,11 +106,11 @@ static PFNglEnableClientState pglEnableClientState;
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_Generate(void);
|
||||
void GLFramebuffer_Delete(void);
|
||||
|
||||
void GLFramebuffer_GenerateAttachments(void);
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
|
||||
|
||||
@@ -773,6 +773,7 @@ void I_DownSample(void)
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
downsample = false; // couldnt get display info so turn the thing off
|
||||
RefreshOGLSDLSurface();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -782,7 +783,10 @@ void I_DownSample(void)
|
||||
RefreshOGLSDLSurface();
|
||||
}
|
||||
else
|
||||
{
|
||||
downsample = false; // its not so no need to do crap
|
||||
RefreshOGLSDLSurface();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (__unix__)
|
||||
|
||||
+17
-13
@@ -196,6 +196,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
#endif
|
||||
@@ -209,15 +210,16 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
RenderToFramebuffer = (FrameBufferEnabled && supportFBO && downsample);
|
||||
GLFramebuffer_Disable();
|
||||
|
||||
if (RenderToFramebuffer
|
||||
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (isnvidiagpu && xwaylandcrap)
|
||||
|| (isnvidiagpu && xwaylandcrap)
|
||||
#endif
|
||||
)
|
||||
);
|
||||
|
||||
if (RenderToFramebuffer)
|
||||
GLFramebuffer_Enable();
|
||||
else
|
||||
GLFramebuffer_Disable();
|
||||
#endif
|
||||
|
||||
HWR_Startup();
|
||||
@@ -255,18 +257,20 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
HWR_MakeScreenFinalTexture();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_Disable();
|
||||
RenderToFramebuffer = (FrameBufferEnabled && supportFBO && downsample);
|
||||
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (isnvidiagpu && xwaylandcrap)
|
||||
#endif
|
||||
);
|
||||
|
||||
if (RenderToFramebuffer)
|
||||
GLFramebuffer_Unbind();
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if ((RenderToFramebuffer && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (isnvidiagpu && xwaylandcrap)
|
||||
#endif
|
||||
)
|
||||
if (RenderToFramebuffer)
|
||||
GLFramebuffer_Enable();
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user