mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
use Hunk_TempAlloc instead of realloc for the alias model verts
This commit is contained in:
parent
c1c76f7058
commit
9ba80eb4d9
2 changed files with 20 additions and 29 deletions
|
@ -697,33 +697,29 @@ R_AliasSetupFrame (void)
|
|||
((byte *) paliashdr + paliasgroup->frames[i].frame);
|
||||
}
|
||||
|
||||
finalvert_t *finalverts;
|
||||
auxvert_t *auxverts;
|
||||
int maxaliasverts = 0;
|
||||
|
||||
void
|
||||
R_AliasDrawModel (alight_t *plighting)
|
||||
{
|
||||
int size;
|
||||
finalvert_t *finalverts;
|
||||
|
||||
r_amodels_drawn++;
|
||||
|
||||
paliashdr = Cache_Get (¤tentity->model->cache);
|
||||
pmdl = (mdl_t *) ((byte *) paliashdr + paliashdr->model);
|
||||
|
||||
if (pmdl->numverts > maxaliasverts)
|
||||
{
|
||||
finalverts = realloc (finalverts, (CACHE_SIZE - 1) +
|
||||
sizeof (finalvert_t) * (pmdl->numverts + 1));
|
||||
auxverts = realloc (auxverts,
|
||||
sizeof (auxvert_t) * pmdl->numverts);
|
||||
if (!finalverts || !auxverts)
|
||||
Sys_Error ("R_AliasDrawModel: out of memory");
|
||||
maxaliasverts = pmdl->numverts;
|
||||
}
|
||||
size = (CACHE_SIZE - 1)
|
||||
+ sizeof (finalvert_t) * (pmdl->numverts + 1)
|
||||
+ sizeof (auxvert_t) * pmdl->numverts;
|
||||
finalverts = (finalvert_t *) Hunk_TempAlloc (size);
|
||||
if (!finalverts)
|
||||
Sys_Error ("R_AliasDrawModel: out of memory");
|
||||
|
||||
// cache align
|
||||
pfinalverts = (finalvert_t *)
|
||||
(((long) &finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
|
||||
pauxverts = &auxverts[0];
|
||||
pauxverts = (auxvert_t *) &pfinalverts[pmdl->numverts + 1];
|
||||
|
||||
R_AliasSetupSkin ();
|
||||
R_AliasSetUpTransform (currententity->trivial_accept);
|
||||
|
|
|
@ -688,33 +688,28 @@ R_AliasSetupFrame (void)
|
|||
}
|
||||
|
||||
|
||||
finalvert_t *finalverts;
|
||||
auxvert_t *auxverts;
|
||||
int maxaliasverts = 0;
|
||||
|
||||
void
|
||||
R_AliasDrawModel (alight_t *plighting)
|
||||
{
|
||||
int size;
|
||||
finalvert_t *finalverts;
|
||||
|
||||
r_amodels_drawn++;
|
||||
|
||||
paliashdr = Cache_Get (¤tentity->model->cache);
|
||||
pmdl = (mdl_t *) ((byte *) paliashdr + paliashdr->model);
|
||||
|
||||
if (pmdl->numverts > maxaliasverts)
|
||||
{
|
||||
finalverts = realloc (finalverts, (CACHE_SIZE - 1) +
|
||||
sizeof (finalvert_t) * (pmdl->numverts + 1));
|
||||
auxverts = realloc (auxverts,
|
||||
sizeof (auxvert_t) * pmdl->numverts);
|
||||
if (!finalverts || !auxverts)
|
||||
Sys_Error ("R_AliasDrawModel: out of memory");
|
||||
maxaliasverts = pmdl->numverts;
|
||||
}
|
||||
size = (CACHE_SIZE - 1)
|
||||
+ sizeof (finalvert_t) * (pmdl->numverts + 1)
|
||||
+ sizeof (auxvert_t) * pmdl->numverts;
|
||||
finalverts = (finalvert_t *) Hunk_TempAlloc (size);
|
||||
if (!finalverts)
|
||||
Sys_Error ("R_AliasDrawModel: out of memory");
|
||||
|
||||
// cache align
|
||||
pfinalverts = (finalvert_t *)
|
||||
(((long) &finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
|
||||
pauxverts = &auxverts[0];
|
||||
pauxverts = (auxvert_t *) &pfinalverts[pmdl->numverts + 1];
|
||||
|
||||
R_AliasSetupSkin ();
|
||||
R_AliasSetUpTransform (currententity->trivial_accept);
|
||||
|
|
Loading…
Reference in a new issue