From: havoc Date: Fri, 1 Apr 2011 09:40:57 +0000 (+0000) Subject: added GL_Finish function in backend, to centralize all the qglFinish X-Git-Tag: xonotic-v0.5.0~313 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5e5cd4cfa17fcf63fce3e1a0db497ef040857d1b;p=xonotic%2Fdarkplaces.git added GL_Finish function in backend, to centralize all the qglFinish calls and accommodate other render paths in such cases git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11003 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=7553655597e4e22766b9ed2394896a2a6905fc32 --- diff --git a/cl_screen.c b/cl_screen.c index 3454252e..60cae502 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -9,7 +9,6 @@ #include "csprogs.h" #include "cap_avi.h" #include "cap_ogg.h" -#include "dpsoftrast.h" // we have to include snd_main.h here only to get access to snd_renderbuffer->format.speed when writing the AVI headers #include "snd_main.h" @@ -736,8 +735,8 @@ void R_TimeReport(const char *desc) return; CHECKGLERROR - if (r_speeds.integer == 2 && qglFinish) - qglFinish(); + if (r_speeds.integer == 2) + GL_Finish(); CHECKGLERROR r_timereport_temp = r_timereport_current; r_timereport_current = Sys_DoubleTime(); @@ -2337,29 +2336,7 @@ void CL_UpdateScreen(void) } if (r_viewscale_fpsscaling.integer) - { - switch(vid.renderpath) - { - case RENDERPATH_GL11: - case RENDERPATH_GL13: - case RENDERPATH_GL20: - case RENDERPATH_GLES2: - qglFinish(); - break; - case RENDERPATH_D3D9: - //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_D3D10: - Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_D3D11: - Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_SOFT: - DPSOFTRAST_Flush(); - break; - } - } + GL_Finish(); drawscreenstart = Sys_DoubleTime(); if (R_Stereo_Active()) { @@ -2394,29 +2371,7 @@ void CL_UpdateScreen(void) else SCR_DrawScreen(); if (r_viewscale_fpsscaling.integer) - { - switch(vid.renderpath) - { - case RENDERPATH_GL11: - case RENDERPATH_GL13: - case RENDERPATH_GL20: - case RENDERPATH_GLES2: - qglFinish(); - break; - case RENDERPATH_D3D9: - //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_D3D10: - Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_D3D11: - Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - break; - case RENDERPATH_SOFT: - DPSOFTRAST_Flush(); - break; - } - } + GL_Finish(); r_refdef.lastdrawscreentime = Sys_DoubleTime() - drawscreenstart; SCR_CaptureVideo(); diff --git a/gl_backend.c b/gl_backend.c index 8ad6989c..7bc929e9 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -543,6 +543,31 @@ void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out[2] = v->z + (out[2] * iw + 1.0f) * v->depth * 0.5f; } +void GL_Finish(void) +{ + switch(vid.renderpath) + { + case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GL20: + case RENDERPATH_GLES2: + qglFinish(); + break; + case RENDERPATH_D3D9: + //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); + break; + case RENDERPATH_D3D10: + Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); + break; + case RENDERPATH_D3D11: + Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); + break; + case RENDERPATH_SOFT: + DPSOFTRAST_Finish(); + break; + } +} + static int bboxedges[12][2] = { // top diff --git a/gl_backend.h b/gl_backend.h index ad6b1dc3..82b9ed4f 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -28,6 +28,7 @@ void R_Viewport_InitCubeSideView(r_viewport_t *v, const matrix4x4_t *cameramatri void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane); void R_SetViewport(const r_viewport_t *v); void R_GetViewport(r_viewport_t *v); +void GL_Finish(void); void GL_BlendFunc(int blendfunc1, int blendfunc2); void GL_DepthMask(int state); diff --git a/vid_agl.c b/vid_agl.c index d0e7c459..b0afdcf9 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -212,11 +212,8 @@ void VID_Finish (void) if (!vid_hidden) { - CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) - { - qglFinish();CHECKGLERROR - } + GL_Finish(); qaglSwapBuffers(context); } VID_UpdateGamma(false, GAMMA_TABLE_SIZE); diff --git a/vid_glx.c b/vid_glx.c index 342e52db..e4240254 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -748,9 +748,7 @@ void VID_Finish (void) { CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) - { - qglFinish();CHECKGLERROR - } + GL_Finish(); qglXSwapBuffers(vidx11_display, win);CHECKGLERROR } diff --git a/vid_sdl.c b/vid_sdl.c index 16cf975e..223ccbe9 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -2491,9 +2491,7 @@ void VID_Finish (void) case RENDERPATH_GLES2: CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) - { - qglFinish();CHECKGLERROR - } + GL_Finish(); #if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2 #else { @@ -2530,6 +2528,8 @@ void VID_Finish (void) case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: + if (r_speeds.integer == 2 || gl_finish.integer) + GL_Finish(); break; } }