mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Make cacheAgeEntries() do a more consistent amount of work per frame
git-svn-id: https://svn.eduke32.com/eduke32@7763 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5cfcb96768
commit
53000d1f31
1 changed files with 10 additions and 8 deletions
|
@ -289,21 +289,23 @@ void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
|||
void cacheAgeEntries(void)
|
||||
{
|
||||
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
|
||||
static int32_t agecount;
|
||||
static int agecount;
|
||||
|
||||
if (agecount >= cacnum)
|
||||
agecount = cacnum-1;
|
||||
|
||||
native_t cnt = (cacnum>>4);
|
||||
int cnt = min(MAXCACHEOBJECTS >> 5, cacnum-1);
|
||||
|
||||
if (agecount < 0 || !cnt)
|
||||
return;
|
||||
|
||||
for (; cnt>=0; cnt--)
|
||||
while(cnt--)
|
||||
{
|
||||
// If we have pointer to lock char and it's in [2 .. 199], decrease.
|
||||
if (cac[agecount].lock && (((*cac[agecount].lock)-2)&255) < 198)
|
||||
(*cac[agecount].lock)--;
|
||||
if (cac[agecount].lock)
|
||||
{
|
||||
if ((((*cac[agecount].lock)-2)&255) < 198)
|
||||
(*cac[agecount].lock)--;
|
||||
else if (*cac[agecount].lock >= 200)
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (--agecount < 0)
|
||||
agecount = cacnum-1;
|
||||
|
|
Loading…
Reference in a new issue