From 53d89bf85acbf91040275275a35ae58247dd3772 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 23 Dec 2011 12:51:47 +0900 Subject: [PATCH] Clean up the mess around D_FlushCaches. Create an R_ClearState and call that from the clients. It calls any necessary functions itself. --- include/QF/render.h | 1 + libs/video/renderer/gl/gl_rmain.c | 8 ++++++++ libs/video/renderer/gl/gl_rmisc.c | 5 ----- libs/video/renderer/sw/sw_rmain.c | 9 +++++++++ libs/video/renderer/sw32/sw32_rmain.c | 9 +++++++++ nq/source/cl_main.c | 4 +--- nq/source/host.c | 1 - nq/source/sv_ded.c | 5 ----- qw/source/cl_main.c | 5 +---- 9 files changed, 29 insertions(+), 18 deletions(-) diff --git a/include/QF/render.h b/include/QF/render.h index dd56ab96a..aa5695bf0 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -152,6 +152,7 @@ extern int r_viewsize; void R_Init (void); void R_Init_Cvars (void); void R_InitEfrags (void); +void R_ClearState (void); void R_InitSky (struct texture_s *mt); // called at level load void R_Textures_Init (void); void R_RenderView (void); // must set r_refdef first diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index 23884fa13..ea1e8deaa 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -947,3 +947,11 @@ R_RenderViewFishEye (void) qfglMatrixMode (GL_MODELVIEW); qfglCallList (fisheye_grid); } + +VISIBLE void +R_ClearState (void) +{ + R_ClearEfrags (); + R_ClearDlights (); + R_ClearParticles (); +} diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index 5659fd09f..e179937e4 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -256,8 +256,3 @@ R_TimeRefresh_f (void) time = stop - start; Sys_MaskPrintf (SYS_DEV, "%f seconds (%f fps)\n", time, 128 / time); } - -VISIBLE void -D_FlushCaches (void) -{ -} diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index d71ae8f27..aa4919c10 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -1190,3 +1190,12 @@ void gl_overbright_f (cvar_t *un) { } + +VISIBLE void +R_ClearState (void) +{ + D_FlushCaches (); + R_ClearEfrags (); + R_ClearDlights (); + R_ClearParticles (); +} diff --git a/libs/video/renderer/sw32/sw32_rmain.c b/libs/video/renderer/sw32/sw32_rmain.c index 9b822a154..1b5450172 100644 --- a/libs/video/renderer/sw32/sw32_rmain.c +++ b/libs/video/renderer/sw32/sw32_rmain.c @@ -912,3 +912,12 @@ void gl_overbright_f (cvar_t *un) { } + +VISIBLE void +R_ClearState (void) +{ + D_FlushCaches (); + R_ClearEfrags (); + R_ClearDlights (); + R_ClearParticles (); +} diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 0321aea71..6fe834814 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -216,9 +216,7 @@ CL_ClearState (void) CL_ClearTEnts (); - R_ClearEfrags (); - R_ClearDlights (); - R_ClearParticles (); + R_ClearState (); CL_ClearEnts (); } diff --git a/nq/source/host.c b/nq/source/host.c index c86a1a40f..52b5d651c 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -496,7 +496,6 @@ void Host_ClearMemory (void) { Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); - D_FlushCaches (); Mod_ClearAll (); if (host_hunklevel) Hunk_FreeToLowMark (host_hunklevel); diff --git a/nq/source/sv_ded.c b/nq/source/sv_ded.c index 800222e9b..e97beca30 100644 --- a/nq/source/sv_ded.c +++ b/nq/source/sv_ded.c @@ -131,11 +131,6 @@ CL_StopPlayback (void) { } -void -D_FlushCaches (void) -{ -} - void IN_ProcessEvents (void) { diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index c075eeeb0..f938091c5 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -413,7 +413,6 @@ CL_ClearState (void) CL_Init_Entity (&cl.viewent); Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); - D_FlushCaches (); Mod_ClearAll (); if (host_hunklevel) // FIXME: check this... Hunk_FreeToLowMark (host_hunklevel); @@ -421,9 +420,7 @@ CL_ClearState (void) CL_ClearEnts (); CL_ClearTEnts (); - R_ClearEfrags (); - R_ClearDlights (); - R_ClearParticles (); + R_ClearState (); SZ_Clear (&cls.netchan.message);