From eefa41a58e4016659aeed8d45a57ab396a860bd5 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 17 Mar 2025 18:43:45 +0100 Subject: [PATCH] Revert "Use PU_LEVEL for texture caching" This reverts commit 5ecfc5e09d912164c68a3d62184bc3a823f02cc9. --- src/r_data.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index 418ad5eec..0971bd5e3 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -324,7 +324,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) { boolean holey = false; patch = texture->patches; - realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL); + realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); // Check the patch for holes. if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) @@ -354,7 +354,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) { texture->holes = true; blocksize = W_LumpLengthPwad(patch->wad, patch->lump); - block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]); + block = Z_Calloc(blocksize, PU_STATIC, // will change tag at end of this function + &texturecache[texnum]); M_Memcpy(block, realpatch, blocksize); texturememory += blocksize; @@ -374,7 +375,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture->holes = false; blocksize = (texture->width * 4) + (texture->width * texture->height); texturememory += blocksize; - block = Z_Malloc(blocksize+1, PU_LEVEL, &texturecache[texnum]); + block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]); memset(block, 0xF7, blocksize+1); // Transparency hack @@ -388,7 +389,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { - realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL); + realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); // Well, it's not valid... if (realpatch == NULL) @@ -416,6 +417,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) } done: + // Now that the texture has been built in column cache, it is purgable from zone memory. + Z_ChangeTag(block, PU_CACHE); return blocktex; } @@ -465,7 +468,7 @@ UINT8 *R_GetColumn(fixed_t tex, INT32 col) // UINT8 *R_GetFlat(lumpnum_t flatlumpnum) { - return W_CacheLumpNum(flatlumpnum, PU_LEVEL); + return W_CacheLumpNum(flatlumpnum, PU_CACHE); } //