Remove Quad-buffered from list of VR-modes if we know it won't work.

This commit is contained in:
Christopher Bruns 2019-02-28 21:19:09 -08:00 committed by Christoph Oelckers
parent 8fab907885
commit 52ab4b968f
8 changed files with 42 additions and 13 deletions

View File

@ -2635,6 +2635,7 @@ void D_DoomMain (void)
V_Init2();
UpdateJoystickMenu(NULL);
UpdateVRModes();
v = Args->CheckValue ("-loadgame");
if (v)

View File

@ -363,4 +363,6 @@ DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotk
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false);
void UpdateVRModes(bool considerQuadBuffered=true);
#endif

View File

@ -1724,3 +1724,31 @@ fail:
}
}
}
#ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues ** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair> & vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const & mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}

View File

@ -34,6 +34,7 @@
#include "gl/system/gl_framebuffer.h"
#include "hwrenderer/postprocessing/hw_presentshader.h"
#include "hwrenderer/postprocessing/hw_present3dRowshader.h"
#include "menu/menu.h"
EXTERN_CVAR(Int, vr_mode)
EXTERN_CVAR(Float, vid_saturation)
@ -283,6 +284,8 @@ bool FGLRenderer::QuadStereoCheckInitialRenderContextState()
// Now check whether this context supports hardware stereo
glGetBooleanv(GL_STEREO, &supportsStereo);
bQuadStereoSupported = supportsStereo && supportsBuffered;
if (! bQuadStereoSupported)
UpdateVRModes(false);
}
}
return bQuadStereoSupported;

View File

@ -361,7 +361,6 @@ public:
float glslversion = 0; // This is here so that the differences between old OpenGL and new OpenGL/Vulkan can be handled by platform independent code.
int instack[2] = { 0,0 }; // this is globally maintained state for portal recursion avoidance.
int stencilValue = 0; // Global stencil test value
bool enable_quadbuffered = false; // Quad-buffered stereo available?
unsigned int uniformblockalignment = 256; // Hardware dependent uniform buffer alignment.
unsigned int maxuniformblock = 65536;
const char *gl_vendorstring; // On OpenGL (not Vulkan) we have to account for some issues with Intel.

View File

@ -56,14 +56,6 @@ extern HWND Window;
PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode.
// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo,
// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo
CUSTOM_CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("You must restart " GAMENAME " to switch quad stereo mode\n");
}
//==========================================================================
//
// Windows framebuffer
@ -111,7 +103,6 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen) : Syst
}
}
ReleaseDC(Window, hDC);
enable_quadbuffered = vr_enable_quadbuffered;
}
//==========================================================================

View File

@ -55,8 +55,6 @@
CVAR(Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
//==========================================================================
//
//

View File

@ -54,7 +54,6 @@
#include "gl/system/gl_framebuffer.h"
EXTERN_CVAR(Int, vid_adapter)
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
EXTERN_CVAR(Bool, vid_hdr)
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
@ -62,6 +61,14 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode.
// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo,
// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo
CUSTOM_CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("You must restart " GAMENAME " to switch quad stereo mode\n");
}
extern bool vid_hdr_active;
// these get used before GLEW is initialized so we have to use separate pointers with different names