diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c3d0daf0d..ef8cc6395 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -775,8 +775,8 @@ static boolean GLFramebuffer_IsFuncAvailible(void) if (majorGL < 3) return false; - return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) && - (isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) && + return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) && + (isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) && (isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions))); return false; diff --git a/src/i_video.h b/src/i_video.h index 708fde03c..6a60f8036 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -140,6 +140,10 @@ UINT32 I_GetRefreshRate(void); boolean I_UseNativeKeyboard(void); #ifdef USE_FBO_OGL +#if defined (__unix__) +extern boolean xwaylandcrap; +#endif + void RefreshOGLSDLSurface(void); void I_DownSample(void); extern boolean downsample; diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index a467187bc..9f6080266 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -217,6 +217,10 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); static void Impl_SetWindowIcon(void); #ifdef USE_FBO_OGL +#if defined (__unix__) +static void I_FixXwaylandNvidia(void); +boolean xwaylandcrap = false; +#endif boolean downsample = false; void RefreshOGLSDLSurface(void) { @@ -278,6 +282,9 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_bool if (rendermode == render_opengl) { #ifdef USE_FBO_OGL +#if defined (__unix__) + I_FixXwaylandNvidia(); +#endif I_DownSample(); #endif OglSdlSurface(vid.width, vid.height); @@ -777,6 +784,23 @@ void I_DownSample(void) else downsample = false; // its not so no need to do crap } + +#if defined (__unix__) +static void I_FixXwaylandNvidia(void) //dumbass crap, fix ur shit nvidia +{ + if (!supportFBO) + { + xwaylandcrap = false; + return; + } + + // enable fbo resize shit, update the ogl surface and turn crap back off lol + xwaylandcrap = true; + RefreshOGLSDLSurface(); + xwaylandcrap = false; + RefreshOGLSDLSurface(); +} +#endif #endif static void Impl_HandleWindowEvent(SDL_WindowEvent evt) diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index e5d0a4441..2a6b80e95 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -68,6 +68,12 @@ PFNglGetIntegerv pglGetIntegerv; PFNglGetString pglGetString; #endif +#if defined (__unix__) +#ifdef USE_FBO_OGL +static boolean isnvidiagpu = false; +#endif +#endif + /** \brief SDL video display surface */ INT32 oglflags = 0; @@ -166,6 +172,13 @@ boolean OglSdlSurface(INT32 w, INT32 h) maximumAnisotropy = 1; granisotropicmode_cons_t[1].value = maximumAnisotropy; + +#if defined (__unix__) +#ifdef USE_FBO_OGL + if (strstr((const char*)gl_renderer, "NVIDIA")) + isnvidiagpu = true; +#endif +#endif } first_init = true; @@ -191,7 +204,11 @@ boolean OglSdlSurface(INT32 w, INT32 h) RenderToFramebuffer = FrameBufferEnabled; GLFramebuffer_Disable(); - if (RenderToFramebuffer && downsample) + if ((RenderToFramebuffer && downsample) +#if defined (__unix__) + || (isnvidiagpu && xwaylandcrap) +#endif + ) GLFramebuffer_Enable(); #endif @@ -229,7 +246,11 @@ void OglSdlFinishUpdate(boolean waitvbl) HWR_DrawScreenFinalTexture(sdlw, sdlh); #ifdef USE_FBO_OGL - if (RenderToFramebuffer && downsample) + if ((RenderToFramebuffer && downsample) +#if defined (__unix__) + || (isnvidiagpu && xwaylandcrap) +#endif + ) GLFramebuffer_Enable(); #endif