From 5e458866bc46c52e19de9fe9b7b75bdf34864dbe Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Tue, 11 Oct 2016 17:10:54 -0400 Subject: [PATCH] - Added CVAR handling for vid_used3d - allows to switch software mode canvas between OpenGL and Direct3D upon restart. --- src/win32/hardware.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index cf39975fd4..da1ced10fa 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -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 - Video = gl_CreateVideo(); -#endif + 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(); 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();