]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Allocate Q3BSP texturepool earlier in the loading process
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 18:04:54 +0000 (18:04 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 18:04:54 +0000 (18:04 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12594 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index e24563f30ea9e70dd45babedc3ac0edec8bf53c9..04cd48843d6263fc2e241424a74343a4e856147d 100644 (file)
@@ -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]);