add just a little more extra safety for fbo

This commit is contained in:
Alug committed 2024-11-03 02:44:42 +01:00
1 parent 2350889445
commit dfec9e24f3
3 files changed
+22 -5

No files matched your search

+16 -2
View File
@@ -706,7 +706,15 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_IsFuncAvailible(void);
static boolean GLFramebuffer_CheckExt(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
// check if all needed gl extensions are available
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
}
#endif
void SetupGLFunc4(void)
@@ -753,7 +761,7 @@ void SetupGLFunc4(void)
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
#ifdef USE_FBO_OGL
if (GLFramebuffer_IsFuncAvailible())
if (GLFramebuffer_CheckExt())
{
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
pglBindFramebuffer = GetGLFunc("glBindFramebuffer");
@@ -766,6 +774,12 @@ void SetupGLFunc4(void)
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
// check if ALL functions are availible
if (pglGenFramebuffers && pglBindFramebuffer &&
pglDeleteFramebuffers && pglFramebufferTexture2D &&
pglCheckFramebufferStatus && pglGenRenderbuffers &&
pglBindRenderbuffer && pglDeleteRenderbuffers &&
pglRenderbufferStorage && pglFramebufferRenderbuffer)
supportFBO = true;
}
#endif
+5 -2
View File
@@ -781,8 +781,11 @@ void I_DownSample(void)
}
else
{
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
if (downsample == true)
{
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
}
}
}
+1 -1
View File
@@ -210,7 +210,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
if (RenderToFramebuffer)
GLFramebuffer_Enable();
else
else if (!first_init)
GLFramebuffer_Disable();
#endif