1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Fix texture cache verification.

This commit is contained in:
Sergey Lipskiy 2013-10-11 15:25:12 +07:00
parent 02c1884382
commit 3380451e00
2 changed files with 15 additions and 5 deletions

View File

@ -15,6 +15,7 @@
#include "convert.h"
#include "2xSAI.h"
#include "FrameBuffer.h"
#include <assert.h>
TextureCache cache;
@ -291,7 +292,9 @@ void TextureCache_Init()
CRC_BuildTable();
}
BOOL TextureCache_Verify()
#ifdef TEXTURE_CACHE_VERIFICATION
static
bool TextureCache_Verify()
{
s16 i = 0;
CachedTexture *current;
@ -303,7 +306,7 @@ BOOL TextureCache_Verify()
i++;
current = current->lower;
}
if (i != cache.numCached) return FALSE;
if (i != cache.numCached) return false;
i = 0;
current = cache.bottom;
@ -312,10 +315,14 @@ BOOL TextureCache_Verify()
i++;
current = current->higher;
}
if (i != cache.numCached) return FALSE;
if (i != cache.numCached) return false;
return TRUE;
return true;
}
#else
static
bool TextureCache_Verify() {return true;}
#endif
void TextureCache_RemoveBottom()
{
@ -338,6 +345,7 @@ void TextureCache_RemoveBottom()
cache.bottom->lower = NULL;
cache.numCached--;
assert(TextureCache_Verify());
}
void TextureCache_Remove( CachedTexture *texture )
@ -373,6 +381,7 @@ void TextureCache_Remove( CachedTexture *texture )
free( texture );
cache.numCached--;
assert(TextureCache_Verify());
}
CachedTexture *TextureCache_AddTop()
@ -402,6 +411,7 @@ CachedTexture *TextureCache_AddTop()
cache.numCached++;
assert(TextureCache_Verify());
return newtop;
}
@ -424,6 +434,7 @@ void TextureCache_MoveToTop( CachedTexture *newtop )
newtop->lower = cache.top;
cache.top->higher = newtop;
cache.top = newtop;
assert(TextureCache_Verify());
}
void TextureCache_Destroy()

View File

@ -84,6 +84,5 @@ void TextureCache_Update( u32 t );
void TextureCache_ActivateTexture( u32 t, CachedTexture *texture );
void TextureCache_ActivateNoise( u32 t );
void TextureCache_ActivateDummy( u32 t );
BOOL TextureCache_Verify();
#endif