From: cloudwalk Date: Tue, 26 May 2020 18:04:54 +0000 (+0000) Subject: Allocate Q3BSP texturepool earlier in the loading process X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=431fe650d5eab5432e1f7e0722b86ca00dce070c;p=xonotic%2Fdarkplaces.git Allocate Q3BSP texturepool earlier in the loading process git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12594 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index e24563f3..04cd4884 100644 --- a/model_brush.c +++ b/model_brush.c @@ -5771,10 +5771,6 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump) if (loadmodel->brushq3.deluxemapping) loadmodel->brushq3.data_deluxemaps = (rtexture_t **)Mem_Alloc(loadmodel->mempool, loadmodel->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); - // allocate a texture pool if we need it - if (loadmodel->texturepool == NULL) - loadmodel->texturepool = R_AllocTexturePool(); - mergedpixels = (unsigned char *) Mem_Alloc(tempmempool, mergedwidth * mergedheight * 4); mergeddeluxepixels = loadmodel->brushq3.deluxemapping ? (unsigned char *) Mem_Alloc(tempmempool, mergedwidth * mergedheight * 4) : NULL; for (i = 0;i < count;i++) @@ -6660,9 +6656,6 @@ static void Mod_Q3BSP_LoadLightGrid(lump_t *l) // bent-normal light color // bent-normal light dir - if (loadmodel->texturepool == NULL) - loadmodel->texturepool = R_AllocTexturePool(); - texturesize[0] = loadmodel->brushq3.num_lightgrid_isize[0]; texturesize[1] = loadmodel->brushq3.num_lightgrid_isize[1]; texturesize[2] = (loadmodel->brushq3.num_lightgrid_isize[2] + 2) * 3; @@ -8025,6 +8018,10 @@ static void Mod_Q3BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) CL_KeepaliveMessage(false); } + // allocate a texture pool if we need it + if (mod->texturepool == NULL) + mod->texturepool = R_AllocTexturePool(); + Mod_Q3BSP_LoadEntities(&header->lumps[Q3LUMP_ENTITIES]); Mod_Q3BSP_LoadTextures(&header->lumps[Q3LUMP_TEXTURES]); Mod_Q3BSP_LoadPlanes(&header->lumps[Q3LUMP_PLANES]);