After an interesting discussion with Lordhavoc, make the GPU do more work in

the background. This is achieved by doing only a (qf)glFlush at the end of
the frame, doing the inter rendering-frame processing (ie, client frame
processing), glFinish, glXSwapBuffers, then starting the next frame. I've
changed the glFinish call in SCR_UpdateScreen to glFlush and the glFlush
call in GL_EndRendering to glFinish because there's no point in calling
glFinish followed by glFlush. Also, SwapBuffers should always be precedded
by glFinish rather than just glFlush (in Lordhavoc's experience). The
GL_EndRendering at the end of SCR_UpdateScreen got moved to the beginning.
This commit is contained in:
Bill Currie 2002-02-27 05:22:21 +00:00
parent 5d3830eeb1
commit 2f62b744fa
6 changed files with 9 additions and 8 deletions

View file

@ -221,7 +221,6 @@ R_TimeRefresh_f (void)
double start, stop, time; double start, stop, time;
int i; int i;
qfglFinish ();
GL_EndRendering (); GL_EndRendering ();
start = Sys_DoubleTime (); start = Sys_DoubleTime ();
@ -229,7 +228,6 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
r_refdef.viewangles[1] = i * (360.0 / 128.0); r_refdef.viewangles[1] = i * (360.0 / 128.0);
R_RenderView (); R_RenderView ();
qfglFinish ();
GL_EndRendering (); GL_EndRendering ();
} }

View file

@ -766,6 +766,8 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs)
if (block_drawing) if (block_drawing)
return; return;
GL_EndRendering ();
r_realtime = realtime; r_realtime = realtime;
vid.numpages = 2 + gl_triplebuffer->int_val; vid.numpages = 2 + gl_triplebuffer->int_val;
@ -855,6 +857,5 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs)
c_alias_polys); c_alias_polys);
} }
qfglFinish (); qfglFlush ();
GL_EndRendering ();
} }

View file

@ -155,7 +155,7 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
qfglFlush (); qfglFinish ();
qf_fxMesaSwapBuffers (); qf_fxMesaSwapBuffers ();
Sbar_Changed (); Sbar_Changed ();
} }

View file

@ -112,7 +112,7 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
qfglFlush (); qfglFinish ();
qfglXSwapBuffers (x_disp, x_win); qfglXSwapBuffers (x_disp, x_win);
Sbar_Changed (); Sbar_Changed ();
} }

View file

@ -120,7 +120,7 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
qfglFlush (); qfglFinish ();
SDL_GL_SwapBuffers (); SDL_GL_SwapBuffers ();
Sbar_Changed (); Sbar_Changed ();
} }

View file

@ -445,8 +445,10 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
if (!scr_skipupdate || block_drawing) if (!scr_skipupdate || block_drawing) {
qfglFinish ();
SwapBuffers (maindc); SwapBuffers (maindc);
}
// handle the mouse state when windowed if that's changed // handle the mouse state when windowed if that's changed
if (modestate == MS_WINDOWED) { if (modestate == MS_WINDOWED) {