Added vid_triplebuffer to enable/disable triplebuffering in d3d (gl_triplebuffer is now an alias to this). Has no effect in OpenGL as OpenGL does not provide a way for an application to set, or even query.

Blocked vid_restart use from configs. Engines that write vid_restart into config.cfg are the antisocial engines that do not understand keeping themselves to themselves, and they can keep their half-speed startups to themselves. Even in such engines, such configs ignore the commandline.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3820 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-06-17 01:54:54 +00:00
parent 2fe74cfda3
commit 74e9d14432
4 changed files with 17 additions and 7 deletions

View file

@ -14,6 +14,7 @@ int sh_shadowframe; //index for msurf->shadowframe
int r_framecount;
struct texture_s *r_notexture_mip;
qboolean r_blockvidrestart;
void R_InitParticleTexture (void);
@ -286,8 +287,8 @@ cvar_t gl_texturemode2d = CVARFC("gl_texturemode2d", "GL_LINEAR",
GL_Texturemode2d_Callback);
#endif
cvar_t gl_triplebuffer = SCVARF ("gl_triplebuffer", "1",
CVAR_ARCHIVE);
cvar_t vid_triplebuffer = CVARAF ("vid_triplebuffer", "1",
"gl_triplebuffer", CVAR_ARCHIVE);
cvar_t r_noportals = SCVAR ("r_noportals", "0");
cvar_t r_noaliasshadows = SCVARF ("r_noaliasshadows", "0",
@ -341,8 +342,6 @@ void GLRenderer_Init(void)
Cvar_Register (&vid_gl_context_es2, GLRENDEREROPTIONS);
//screen
Cvar_Register (&gl_triplebuffer, GLRENDEREROPTIONS);
Cvar_Register (&vid_preservegamma, GLRENDEREROPTIONS);
Cvar_Register (&vid_hardwaregamma, GLRENDEREROPTIONS);
Cvar_Register (&vid_desktopgamma, GLRENDEREROPTIONS);
@ -480,6 +479,7 @@ void Renderer_Init(void)
currentrendererstate.renderer = NULL;
qrenderer = QR_NONE;
r_blockvidrestart = true;
Cmd_AddCommand("setrenderer", R_SetRenderer_f);
Cmd_AddCommand("vid_restart", R_RestartRenderer_f);
@ -510,6 +510,7 @@ void Renderer_Init(void)
Cvar_Register (&vid_conheight, VIDCOMMANDGROUP);
Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP);
Cvar_Register (&vid_triplebuffer, VIDCOMMANDGROUP);
Cvar_Register (&vid_width, VIDCOMMANDGROUP);
Cvar_Register (&vid_height, VIDCOMMANDGROUP);
Cvar_Register (&vid_refreshrate, VIDCOMMANDGROUP);
@ -615,6 +616,7 @@ qboolean Renderer_Started(void)
void Renderer_Start(void)
{
r_blockvidrestart = false;
Cvar_ApplyLatches(CVAR_RENDERERLATCH);
//renderer = none && currentrendererstate.bpp == -1 means we've never applied any mode at all
@ -1283,6 +1285,12 @@ void R_RestartRenderer_f (void)
int i, j;
rendererstate_t oldr;
rendererstate_t newr;
if (r_blockvidrestart)
{
Con_Printf("Ignoring vid_restart from config\n");
return;
}
M_Shutdown();
memset(&newr, 0, sizeof(newr));
@ -1295,6 +1303,7 @@ TRACE(("dbg: R_RestartRenderer_f\n"));
newr.width = vid_width.value;
newr.height = vid_height.value;
newr.triplebuffer = vid_triplebuffer.value;
newr.multisample = vid_multisample.value;
newr.bpp = vid_bpp.value;
newr.fullscreen = vid_fullscreen.value;

View file

@ -36,6 +36,7 @@ typedef struct {
int rate;
int wait; //-1 = default, 0 = off, 1 = on, 2 = every other
int multisample; //for opengl antialiasing (which requires context stuff)
int triplebuffer;
char glrenderer[MAX_QPATH];
struct rendererinfo_s *renderer;
} rendererstate_t;

View file

@ -469,7 +469,7 @@ static qboolean initD3D9Device(HWND hWnd, rendererstate_t *info, unsigned int de
d3dpp.BackBufferWidth = info->width;
d3dpp.BackBufferHeight = info->height;
d3dpp.MultiSampleType = info->multisample;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferCount = 1 + info->triplebuffer;
d3dpp.FullScreen_RefreshRateInHz = info->fullscreen?info->rate:0; //don't pass a rate if not fullscreen, d3d doesn't like it.
d3dpp.Windowed = !info->fullscreen;

View file

@ -33,7 +33,7 @@ void GLSCR_UpdateScreen (void);
extern qboolean scr_drawdialog;
extern cvar_t gl_triplebuffer;
extern cvar_t vid_triplebuffer;
extern cvar_t scr_fov;
extern qboolean scr_initialized;
@ -68,7 +68,7 @@ void GLSCR_UpdateScreen (void)
qboolean noworld;
RSpeedMark();
vid.numpages = 2 + gl_triplebuffer.value;
vid.numpages = 2 + vid_triplebuffer.value;
if (scr_disabled_for_loading)
{