mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- Implemented a simple graphics switch. This currently affects NVidia Optimus-enabled notebooks only.
This commit is contained in:
parent
5e5f88b629
commit
4ebd25171c
3 changed files with 48 additions and 1 deletions
|
@ -71,8 +71,34 @@ FRenderer *gl_CreateInterface();
|
|||
void I_RestartRenderer();
|
||||
int currentrenderer = -1;
|
||||
int currentcanvas = -1;
|
||||
int currentgpuswitch = -1;
|
||||
bool changerenderer;
|
||||
|
||||
// Optimus/Hybrid switcher
|
||||
CUSTOM_CVAR(Int, vid_gpuswitch, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (self != currentgpuswitch)
|
||||
{
|
||||
switch (self)
|
||||
{
|
||||
case 0:
|
||||
Printf("Selecting default GPU...\n");
|
||||
break;
|
||||
case 1:
|
||||
Printf("Selecting high-performance dedicated GPU...\n");
|
||||
break;
|
||||
case 2:
|
||||
Printf("Selecting power-saving integrated GPU...\n");
|
||||
break;
|
||||
default:
|
||||
Printf("Unknown option (%d) - falling back to 'default'\n", *vid_gpuswitch);
|
||||
self = 0;
|
||||
break;
|
||||
}
|
||||
Printf("You must restart " GAMENAME " for this change to take effect.\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Software OpenGL canvas
|
||||
CUSTOM_CVAR(Bool, vid_used3d, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
|
@ -128,6 +154,13 @@ void I_InitGraphics ()
|
|||
{
|
||||
UCVarValue val;
|
||||
|
||||
// todo: implement ATI version of this. this only works for nvidia notebooks, for now.
|
||||
currentgpuswitch = vid_gpuswitch;
|
||||
if (currentgpuswitch == 1)
|
||||
putenv("SHIM_MCCOMPAT=0x800000001"); // discrete
|
||||
else if (currentgpuswitch == 2)
|
||||
putenv("SHIM_MCCOMPAT=0x800000000"); // integrated
|
||||
|
||||
// If the focus window is destroyed, it doesn't go back to the active window.
|
||||
// (e.g. because the net pane was up, and a button on it had focus)
|
||||
if (GetFocus() == NULL && GetActiveWindow() == Window)
|
||||
|
|
|
@ -1832,6 +1832,7 @@ DSPLYMNU_DIMCOLOR = "Dim color";
|
|||
DSPLYMNU_MOVEBOB = "View bob amount while moving";
|
||||
DSPLYMNU_STILLBOB = "View bob amount while not moving";
|
||||
DSPLYMNU_BOBSPEED = "Weapon bob speed";
|
||||
DSPLYMNU_GPUSWITCH = "Notebook Switchable GPU";
|
||||
|
||||
// HUD Options
|
||||
HUDMNU_TITLE = "HUD Options";
|
||||
|
@ -2359,6 +2360,8 @@ OPTVAL_GL = "OpenGL";
|
|||
OPTVAL_D3D = "Direct3D";
|
||||
OPTVAL_HWPOLY = "OpenGL-Accelerated";
|
||||
OPTVAL_SWDOOM = "Doom Software Renderer";
|
||||
OPTVAL_DEDICATED = "High-Performance";
|
||||
OPTVAL_INTEGRATED = "Power-Saving";
|
||||
|
||||
// Colors
|
||||
C_BRICK = "\cabrick";
|
||||
|
|
|
@ -683,6 +683,13 @@ OptionValue Fuzziness
|
|||
2.0, "$OPTVAL_SHADOW"
|
||||
}
|
||||
|
||||
OptionValue GPUSwitch
|
||||
{
|
||||
0.0, "$OPTVAL_DEFAULT"
|
||||
1.0, "$OPTVAL_DEDICATED"
|
||||
2.0, "$OPTVAL_INTEGRATED"
|
||||
}
|
||||
|
||||
OptionMenu "OpenGLOptions"
|
||||
{
|
||||
Title "$GLMNU_TITLE"
|
||||
|
@ -755,7 +762,11 @@ OptionMenu "VideoOptions"
|
|||
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
|
||||
Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2
|
||||
Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1
|
||||
|
||||
IfOption(Windows)
|
||||
{
|
||||
StaticText " "
|
||||
Option "$DSPLYMNU_GPUSWITCH", vid_gpuswitch, "GPUSwitch"
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue