- live switching of the renderer works.

This commit is contained in:
Christoph Oelckers 2018-04-07 12:59:04 +02:00
parent 221beec979
commit 5fbc723842
5 changed files with 31 additions and 79 deletions

View file

@ -434,7 +434,7 @@ void FGLRenderer::RenderView(player_t* player)
gl_RenderState.SetVertexBuffer(mVBO);
mVBO->Reset();
if (currentrenderer == 0 && 0)
if (currentrenderer == 0)
{
if (swdrawer == nullptr) swdrawer = new SWSceneDrawer;
swdrawer->RenderView(player);

View file

@ -102,7 +102,7 @@
DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen);
int currentrenderer;
extern int currentrenderer;
EXTERN_CVAR(Bool, ticker )
EXTERN_CVAR(Bool, vid_vsync)
@ -137,31 +137,6 @@ CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_
Printf("You must restart " GAMENAME " to apply graphics switching mode\n");
}
CUSTOM_CVAR(Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// 0: Software renderer
// 1: OpenGL renderer
if (self != currentrenderer)
{
switch (self)
{
case 0:
Printf("Switching to software renderer...\n");
break;
case 1:
Printf("Switching to OpenGL renderer...\n");
break;
default:
Printf("Unknown renderer (%d). Falling back to software renderer...\n",
static_cast<int>(vid_renderer));
self = 0;
break;
}
Printf("You must restart " GAMENAME " to switch the renderer\n");
}
}
EXTERN_CVAR(Bool, gl_smooth_rendered)

View file

@ -61,32 +61,6 @@ extern int NewWidth, NewHeight, NewBits, DisplayBits;
bool V_DoModeSetup (int width, int height, int bits);
void I_RestartRenderer();
int currentrenderer;
// [ZDoomGL]
CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// 0: Software renderer
// 1: OpenGL renderer
if (self != currentrenderer)
{
switch (self)
{
case 0:
Printf("Switching to software renderer...\n");
break;
case 1:
Printf("Switching to OpenGL renderer...\n");
break;
default:
Printf("Unknown renderer (%d). Falling back to software renderer...\n", (int) vid_renderer);
self = 0; // make sure to actually switch to the software renderer
break;
}
}
currentrenderer = self;
}
void I_ShutdownGraphics ()
{

View file

@ -104,6 +104,34 @@ CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
}
}
int currentrenderer = -1;
// [ZDoomGL]
CUSTOM_CVAR(Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// 0: Software renderer
// 1: OpenGL renderer
if (self != currentrenderer)
{
switch (self)
{
case 0:
Printf("Switching to software renderer...\n");
break;
case 1:
Printf("Switching to OpenGL renderer...\n");
break;
default:
Printf("Unknown renderer (%d). Falling back to software renderer...\n", (int)vid_renderer);
self = 0; // make sure to actually switch to the software renderer
break;
}
}
currentrenderer = self;
}
EXTERN_CVAR(Bool, r_blendmethod)
int active_con_scale();

View file

@ -67,7 +67,7 @@ IVideo *Video;
IVideo *gl_CreateVideo();
void I_RestartRenderer();
int currentrenderer = -1;
extern int currentrenderer;
int currentcanvas = -1;
int currentgpuswitch = -1;
bool changerenderer;
@ -97,31 +97,6 @@ CUSTOM_CVAR(Int, vid_gpuswitch, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
}
}
// [ZDoomGL]
CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// 0: Software renderer
// 1: OpenGL renderer
if (self != currentrenderer)
{
switch (self)
{
case 0:
Printf("Switching to software renderer...\n");
break;
case 1:
Printf("Switching to OpenGL renderer...\n");
break;
default:
Printf("Unknown renderer (%d). Falling back to software renderer...\n", *vid_renderer);
self = 0; // make sure to actually switch to the software renderer
break;
}
//changerenderer = true;
Printf("You must restart " GAMENAME " to switch the renderer\n");
}
}
CCMD (vid_restart)
{