From efaf1eb2a15af59057ab22632c99a83a2cec58f1 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 15 Feb 2025 01:05:44 +0100 Subject: [PATCH] move texture precache into own function unnesting stuff --- src/hardware/hw_cache.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index b661dc243..13dc86ecc 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -551,7 +551,7 @@ void HWR_FreeTextureCache(void) gl_numtextures = 0; } -static void P_PrecacheHWRLevelFlats(void) +static void HWR_PrecacheLevelFlats(void) { lumpnum_t lump; size_t i, j; @@ -585,18 +585,11 @@ static void P_PrecacheHWRLevelFlats(void) } } -void HWR_PrecacheLevel(void) +static void HWR_PrecacheLevelTextures(void) { char *texturepresent; size_t i, j; - if (rendermode != render_opengl) - return; - - // Precache flats. - P_PrecacheHWRLevelFlats(); - - // Precache textures. texturepresent = calloc(numtextures, sizeof (*texturepresent)); if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel"); @@ -649,6 +642,18 @@ void HWR_PrecacheLevel(void) HWR_GetTexture(i, true); } free(texturepresent); +} + +void HWR_PrecacheLevel(void) +{ + if (rendermode != render_opengl) + return; + + // Precache flats. + HWR_PrecacheLevelFlats(); + + // Precache textures. + HWR_PrecacheLevelTextures(); //TODO: precache sprites too }