From d8a33d73cc387acaab8cf6ee3db540aba5c9eb82 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 8 Sep 2014 04:31:26 +0000 Subject: [PATCH] R_CullSurfaces: small optimization. Avoid doing (s->visframe == r_visframecount) test on all world surfaces, instead, use the surfaces in the world texture chains, which already passed that test in R_MarkSurfaces. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@991 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/r_world.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Quake/r_world.c b/Quake/r_world.c index f1ab0444..c0830beb 100644 --- a/Quake/r_world.c +++ b/Quake/r_world.c @@ -203,14 +203,21 @@ void R_CullSurfaces (void) { msurface_t *s; int i; + texture_t *t; if (!r_drawworld_cheatsafe) return; - s = &cl.worldmodel->surfaces[cl.worldmodel->firstmodelsurface]; - for (i=0 ; inummodelsurfaces ; i++, s++) +// ericw -- instead of testing (s->visframe == r_visframecount) on all world +// surfaces, use the chained surfaces, which is exactly the same set of sufaces + for (i=0 ; inumtextures ; i++) { - if (s->visframe == r_visframecount) + t = cl.worldmodel->textures[i]; + + if (!t || !t->texturechains[chain_world]) + continue; + + for (s = t->texturechains[chain_world]; s; s = s->texturechain) { if (R_CullBox(s->mins, s->maxs) || R_BackFaceCull (s)) s->culled = true;