From accee1263e7780ffab71cb4701d24f436296ce15 Mon Sep 17 00:00:00 2001 From: ewasylishen Date: Tue, 5 Aug 2014 18:22:58 +0000 Subject: [PATCH] AllocBlock: cache index of last used lightmap, start search there Can speed up map loading by multiple seconds on levels with a lot of lightmaps, at a cost of using slightly more lightmaps (about 5% more). https://sourceforge.net/p/quakespasm/patches/20/ git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@956 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/r_brush.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/r_brush.c b/quakespasm/Quake/r_brush.c index 4805e066..0f43dbc0 100644 --- a/quakespasm/Quake/r_brush.c +++ b/quakespasm/Quake/r_brush.c @@ -45,6 +45,7 @@ qboolean lightmap_modified[MAX_LIGHTMAPS]; glRect_t lightmap_rectchange[MAX_LIGHTMAPS]; int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH]; +int last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in // the lightmap texture data needs to be kept in // main memory so texsubimage can update properly @@ -716,7 +717,12 @@ int AllocBlock (int w, int h, int *x, int *y) int best, best2; int texnum; - for (texnum=0 ; texnum