From 431f5bd09f8c322bdd132072e2c806a06c93140d Mon Sep 17 00:00:00 2001 From: moto Date: Thu, 19 May 2022 12:19:25 -0400 Subject: [PATCH] ericw's AllocBlock optimization --- source/psp/video_hardware_surface.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/source/psp/video_hardware_surface.cpp b/source/psp/video_hardware_surface.cpp index 97b1209..1a46bd4 100644 --- a/source/psp/video_hardware_surface.cpp +++ b/source/psp/video_hardware_surface.cpp @@ -40,6 +40,7 @@ extern int LIGHTMAP_BYTES; using namespace quake; int skytexturenum; +int last_lightmap_allocated; // ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in #define BLOCK_WIDTH 128 #define BLOCK_HEIGHT 128 @@ -1627,14 +1628,23 @@ void R_MarkLeaves (void) ============================================================================= */ -// returns a texture number and the position inside it -static int AllocBlock (int w, int h, int *x, int *y) +/* +======================== +AllocBlock -- returns a texture number and the position inside it +======================== +*/ +int AllocBlock (int w, int h, int *x, int *y) { int i, j; int best, best2; int texnum; - for (texnum=0 ; texnum BLOCK_HEIGHT) - { - //Con_Printf("best + h > BLOCK_HEIGHT\n"); continue; - } + for (i=0 ; i