From d2ead39bccb393f8496e4ba9176f464ec5b4bf3f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Sep 2016 14:16:05 +0200 Subject: [PATCH] - force framebuffers for camera textures on GL 3+ hardware. With all the postprocessing stuff added I don't think it's ok to use the screenbuffer for this anymore. - disable framebuffers for camera textures in legacy mode entirely. This depends on a GL_DEPTH24_STENCIL8 surface which most of these old chipsets do not support, and I really see no point to invest any work here. The worst that can happen is that oversized camera textures won't be processed, which, due to general performance issues, might even be a good thing. --- src/gl/scene/gl_scene.cpp | 25 ++++++------------------- wadsrc/static/language.enu | 4 ---- wadsrc/static/menudef.z | 1 - 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 23d7c7c80..8a2764829 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -1317,29 +1317,16 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in gl_fixedcolormap=CM_DEFAULT; gl_RenderState.SetFixedColormap(CM_DEFAULT); - bool usefb = !gl.legacyMode || gl_usefb || gltex->GetWidth() > screen->GetWidth() || gltex->GetHeight() > screen->GetHeight(); - if (!usefb) + if (gl.legacyMode) { + // In legacy mode, fail if the requested texture is too large. + if (gltex->GetWidth() > screen->GetWidth() || gltex->GetHeight() > screen->GetHeight()) return; glFlush(); } else { -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__INTEL_COMPILER)) - __try -#endif - { - GLRenderer->StartOffscreen(); - gltex->BindToFrameBuffer(); - } -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__INTEL_COMPILER)) - __except(1) - { - usefb = false; - gl_usefb = false; - GLRenderer->EndOffscreen(); - glFlush(); - } -#endif + GLRenderer->StartOffscreen(); + gltex->BindToFrameBuffer(); } GL_IRECT bounds; @@ -1349,7 +1336,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in GLRenderer->RenderViewpoint(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false, false); - if (!usefb) + if (gl.legacyMode) { glFlush(); gl_RenderState.SetMaterial(gltex, 0, 0, -1, false); diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index d2da033d7..c7d19fd92 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2594,7 +2594,6 @@ GLTEXMNU_RESIZETEX = "Resize textures"; GLTEXMNU_RESIZESPR = "Resize sprites"; GLTEXMNU_RESIZEFNT = "Resize fonts"; GLTEXMNU_PRECACHETEX = "Precache GL textures"; -GLTEXMNU_CAMTEXOFFSCR = "Camera textures offscreen"; GLTEXMNU_TRIMSPREDGE = "Trim sprite edges"; GLTEXMNU_SORTDRAWLIST = "Sort draw lists by texture"; @@ -2605,9 +2604,6 @@ GLLIGHTMNU_LIGHTDEFS = "Enable light definitions"; GLLIGHTMNU_CLIPLIGHTS = "Clip lights"; GLLIGHTMNU_LIGHTSPRITES = "Lights affect sprites"; GLLIGHTMNU_LIGHTPARTICLES = "Lights affect particles"; -GLLIGHTMNU_FORCEADDITIVE = "Force additive lighting"; -GLLIGHTMNU_LIGHTINTENSITY = "Light intensity"; -GLLIGHTMNU_LIGHTSIZE = "Light size"; // OpenGL Preferences GLPREFMNU_TITLE = "OPENGL PREFERENCES"; diff --git a/wadsrc/static/menudef.z b/wadsrc/static/menudef.z index 8879d6170..980cdacc3 100644 --- a/wadsrc/static/menudef.z +++ b/wadsrc/static/menudef.z @@ -185,7 +185,6 @@ OptionMenu "GLTextureGLOptions" Option "$GLTEXMNU_RESIZESPR", gl_texture_hqresize_sprites, "OnOff" Option "$GLTEXMNU_RESIZEFNT", gl_texture_hqresize_fonts, "OnOff" Option "$GLTEXMNU_PRECACHETEX", gl_precache, "YesNo" - Option "$GLTEXMNU_CAMTEXOFFSCR", gl_usefb, "OnOff" Option "$GLTEXMNU_TRIMSPREDGE", gl_trimsprites, "OnOff" Option "$GLTEXMNU_SORTDRAWLIST", gl_sort_textures, "YesNo" }