added GL_Finish function in backend, to centralize all the qglFinish
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 1 Apr 2011 09:40:57 +0000 (09:40 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 1 Apr 2011 09:40:57 +0000 (09:40 +0000)
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

cl_screen.c
gl_backend.c
gl_backend.h
vid_agl.c
vid_glx.c
vid_sdl.c

index 476f6d5..5453004 100644 (file)
@@ -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();
index 8ad6989..7bc929e 100644 (file)
@@ -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
index ad6b1dc..82b9ed4 100644 (file)
@@ -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);
index d0e7c45..b0afdcf 100644 (file)
--- 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);
index 342e52d..e424025 100644 (file)
--- 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
        }
 
index 5421f95..e7b770d 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -2552,9 +2552,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
 {
@@ -2591,6 +2589,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;
                }
        }