]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
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 476f6d577c1bff53cbbb23194f7172510e79d07b..545300425a314ba34041d9f526dd0578557cff45 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 8ad6989c46f15d6e5d65a2dbc12b119abe5a4787..7bc929e9b60d5864a8ffbd84759cb4f8c69db2d2 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 ad6b1dc389825c353f2d080b5ac26f8892d6fb5c..82b9ed4f0a654eb6abd9f0b0e3aa6227708d6ad4 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 d0e7c4595e28e0b3f6647e7062b6ca76f0beb317..b0afdcf98126dfe3f99be8ffc4b12066e2facb3f 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 342e52dbdd855fc8ef4907979edaca98d8a0b097..e42402540232679ac11493c778de05ad5e5544a7 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 5421f9532d1f3139dc5c0c99bf1d12e7068ff44a..e7b770d6400252a8ac909be69eaddc14dd207c05 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;
                }
        }