From 91a3b288eff25ad58c1fcba29fec93f84d0374e9 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 27 Mar 2024 18:08:09 +0100 Subject: [PATCH] conflict moment --- src/hardware/r_opengl/r_opengl.c | 38 ++++---------------------------- src/sdl/ogl_sdl.c | 19 ++-------------- 2 files changed, 6 insertions(+), 51 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 78b34c63f..d17c29e04 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -432,9 +432,11 @@ static PFNglCopyTexImage2D pglCopyTexImage2D; typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); static PFNglCopyTexSubImage2D pglCopyTexSubImage2D; +#ifdef GL_VERSION_3_0 /* 3.0 functions */ typedef void (APIENTRY * PFNglGenerateMipmap) (GLenum target); static PFNglGenerateMipmap pglGenerateMipmap; +#endif /* 3.0 functions for framebuffers and renderbuffers */ typedef void (APIENTRY * PFNglGenFramebuffers) (GLsizei n, GLuint *ids); @@ -742,7 +744,9 @@ void SetupGLFunc4(void) pglUniform3fv = GetGLFunc("glUniform3fv"); pglGetUniformLocation = GetGLFunc("glGetUniformLocation"); +#ifdef GL_VERSION_3_0 pglGenerateMipmap = GetGLFunc("glGenerateMipmap"); +#endif if (GLFramebuffer_IsFuncAvailible()) { @@ -1102,40 +1106,6 @@ void GLFramebuffer_Disable(void) pglBindRenderbuffer(GL_RENDERBUFFER, 0); } -// -----------------+ -// DeleteTexture : Deletes a texture from the GPU and frees its data -// -----------------+ -EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) -{ - FTextureInfo *head = TexCacheHead; - - if (!pTexInfo) - return; - else if (pTexInfo->downloaded) - pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); - - while (head) - { - if (head->downloaded == pTexInfo->downloaded) - { - if (head->next) - head->next->prev = head->prev; - else // no next -> tail is being deleted -> update TexCacheTail - TexCacheTail = head->prev; - if (head->prev) - head->prev->next = head->next; - else // no prev -> head is being deleted -> update TexCacheHead - TexCacheHead = head->next; - free(head); - break; - } - - head = head->next; - } - - pTexInfo->downloaded = 0; -} - // -----------------+ // Flush : flush OpenGL textures diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 71e7fcdab..06fb5df27 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -162,16 +162,8 @@ boolean OglSdlSurface(INT32 w, INT32 h) SetupGLFunc4(); granisotropicmode_cons_t[1].value = maximumAnisotropy; - - if (cv_vidwait.value) - { - if (SDL_GL_SetSwapInterval(-1) != 0) // try async vsync - SDL_GL_SetSwapInterval(1); // normal vsync - } - else - SDL_GL_SetSwapInterval(0); - //SDL_GL_SetSwapInterval(cv_vidwait.value ? -1 : 0); + SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); // The screen textures need to be flushed if the width or height change so that they be remade for the correct size if (screen_width != w || screen_height != h) @@ -211,14 +203,7 @@ void OglSdlFinishUpdate(boolean waitvbl) int sdlw, sdlh; if (oldwaitvbl != waitvbl) { - if (waitvbl) - { - if (SDL_GL_SetSwapInterval(-1) != 0) // try async vsync - SDL_GL_SetSwapInterval(1); // normal vsync - } - else - SDL_GL_SetSwapInterval(0); - //SDL_GL_SetSwapInterval(waitvbl ? -1 : 0); + SDL_GL_SetSwapInterval(waitvbl ? 1 : 0); } oldwaitvbl = waitvbl;