- 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.
This commit is contained in:
Christoph Oelckers 2016-09-04 14:16:05 +02:00
parent 95bedac6ca
commit d2ead39bcc
3 changed files with 6 additions and 24 deletions

View File

@ -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);

View File

@ -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";

View File

@ -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"
}