From cbe31e2eb9c6202b821c67faffcbc5c31fe91b12 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 12 Nov 2007 02:22:53 +0000 Subject: [PATCH] avoid one viewclear each frame git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7684 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_screen.c | 5 +++-- client.h | 3 +++ gl_rmain.c | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index 8e1626c7..f905af34 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2139,7 +2139,8 @@ void CL_UpdateScreen(void) qglDepthMask(1);CHECKGLERROR qglColorMask(1,1,1,1);CHECKGLERROR qglClearColor(0,0,0,0);CHECKGLERROR - qglClear(GL_COLOR_BUFFER_BIT);CHECKGLERROR + R_ClearScreen(); + r_view.clear = false; if(scr_stipple.integer) { @@ -2164,7 +2165,7 @@ void CL_UpdateScreen(void) qglDisable(GL_POLYGON_STIPPLE); if (r_timereport_active) - R_TimeReport("clearscreeb"); + R_TimeReport("screenclear"); qglDrawBuffer(GL_BACK); diff --git a/client.h b/client.h index 830b9331..d0368835 100644 --- a/client.h +++ b/client.h @@ -1435,6 +1435,9 @@ typedef struct r_view_s // global RGB color multiplier for rendering, this is required by HDR float colorscale; + // whether to call R_ClearScreen before rendering stuff + qboolean clear; + // whether to draw r_showtris and such, this is only true for the main // view render, all secondary renders (HDR, mirrors, portals, cameras, // distortion effects, etc) omit such debugging information diff --git a/gl_rmain.c b/gl_rmain.c index 06a18fb6..cbc74a3c 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2763,6 +2763,8 @@ static void R_Water_ProcessPlanes(void) R_ResetViewRendering3D(); R_ClearScreen(); + if (r_timereport_active) + R_TimeReport("viewclear"); R_RenderScene(false); @@ -2773,9 +2775,12 @@ static void R_Water_ProcessPlanes(void) R_ResetViewRendering3D(); R_ClearScreen(); + if (r_timereport_active) + R_TimeReport("viewclear"); } r_view = originalview; + r_view.clear = true; r_waterstate.renderingscene = false; } return; @@ -3067,8 +3072,7 @@ void R_HDR_RenderBloomTexture(void) R_ClearScreen(); if (r_timereport_active) - R_TimeReport("hdrclear"); - + R_TimeReport("viewclear"); // restore the view settings r_view.width = oldwidth; @@ -3234,9 +3238,13 @@ void R_RenderView(void) R_ResetViewRendering3D(); - R_ClearScreen(); - if (r_timereport_active) - R_TimeReport("viewclear"); + if (r_view.clear) + { + R_ClearScreen(); + if (r_timereport_active) + R_TimeReport("viewclear"); + } + r_view.clear = true; r_view.showdebug = true; -- 2.39.2