- Added CVAR handling for vid_used3d - allows to switch software mode canvas between OpenGL and Direct3D upon restart.

This commit is contained in:
raa-eruanna 2016-10-11 17:10:54 -04:00
parent 289e76cce7
commit 5e458866bc

View file

@ -69,8 +69,16 @@ FRenderer *gl_CreateInterface();
void I_RestartRenderer();
int currentrenderer = -1;
int currentcanvas = -1;
bool changerenderer;
// Software OpenGL canvas
CUSTOM_CVAR(Bool, vid_used3d, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (self != currentcanvas)
Printf("You must restart " GAMENAME " for this change to take effect.\n");
}
// [ZDoomGL]
CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
@ -137,13 +145,13 @@ void I_InitGraphics ()
val.Bool = !!Args->CheckParm ("-devparm");
ticker.SetGenericRepDefault (val, CVAR_Bool);
//#define USE_D3D9_VIDEO
#ifdef USE_D3D9_VIDEO
if (currentrenderer == 1) Video = gl_CreateVideo();
else Video = new Win32Video(0);
#else
if (currentcanvas == 1) // Software Canvas: 1 = D3D or DirectDraw, 0 = OpenGL
if (currentrenderer == 1)
Video = gl_CreateVideo();
else
Video = new Win32Video(0);
else
Video = gl_CreateVideo();
#endif
if (Video == NULL)
I_FatalError ("Failed to initialize display");
@ -161,6 +169,7 @@ static void I_DeleteRenderer()
void I_CreateRenderer()
{
currentrenderer = vid_renderer;
currentcanvas = vid_used3d;
if (Renderer == NULL)
{
if (currentrenderer==1) Renderer = gl_CreateInterface();