mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix texture cache verification.
This commit is contained in:
parent
02c1884382
commit
3380451e00
19
Textures.cpp
19
Textures.cpp
|
@ -15,6 +15,7 @@
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "2xSAI.h"
|
#include "2xSAI.h"
|
||||||
#include "FrameBuffer.h"
|
#include "FrameBuffer.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
TextureCache cache;
|
TextureCache cache;
|
||||||
|
|
||||||
|
@ -291,7 +292,9 @@ void TextureCache_Init()
|
||||||
CRC_BuildTable();
|
CRC_BuildTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL TextureCache_Verify()
|
#ifdef TEXTURE_CACHE_VERIFICATION
|
||||||
|
static
|
||||||
|
bool TextureCache_Verify()
|
||||||
{
|
{
|
||||||
s16 i = 0;
|
s16 i = 0;
|
||||||
CachedTexture *current;
|
CachedTexture *current;
|
||||||
|
@ -303,7 +306,7 @@ BOOL TextureCache_Verify()
|
||||||
i++;
|
i++;
|
||||||
current = current->lower;
|
current = current->lower;
|
||||||
}
|
}
|
||||||
if (i != cache.numCached) return FALSE;
|
if (i != cache.numCached) return false;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
current = cache.bottom;
|
current = cache.bottom;
|
||||||
|
@ -312,10 +315,14 @@ BOOL TextureCache_Verify()
|
||||||
i++;
|
i++;
|
||||||
current = current->higher;
|
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()
|
void TextureCache_RemoveBottom()
|
||||||
{
|
{
|
||||||
|
@ -338,6 +345,7 @@ void TextureCache_RemoveBottom()
|
||||||
cache.bottom->lower = NULL;
|
cache.bottom->lower = NULL;
|
||||||
|
|
||||||
cache.numCached--;
|
cache.numCached--;
|
||||||
|
assert(TextureCache_Verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache_Remove( CachedTexture *texture )
|
void TextureCache_Remove( CachedTexture *texture )
|
||||||
|
@ -373,6 +381,7 @@ void TextureCache_Remove( CachedTexture *texture )
|
||||||
free( texture );
|
free( texture );
|
||||||
|
|
||||||
cache.numCached--;
|
cache.numCached--;
|
||||||
|
assert(TextureCache_Verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedTexture *TextureCache_AddTop()
|
CachedTexture *TextureCache_AddTop()
|
||||||
|
@ -402,6 +411,7 @@ CachedTexture *TextureCache_AddTop()
|
||||||
|
|
||||||
cache.numCached++;
|
cache.numCached++;
|
||||||
|
|
||||||
|
assert(TextureCache_Verify());
|
||||||
return newtop;
|
return newtop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +434,7 @@ void TextureCache_MoveToTop( CachedTexture *newtop )
|
||||||
newtop->lower = cache.top;
|
newtop->lower = cache.top;
|
||||||
cache.top->higher = newtop;
|
cache.top->higher = newtop;
|
||||||
cache.top = newtop;
|
cache.top = newtop;
|
||||||
|
assert(TextureCache_Verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache_Destroy()
|
void TextureCache_Destroy()
|
||||||
|
|
|
@ -84,6 +84,5 @@ void TextureCache_Update( u32 t );
|
||||||
void TextureCache_ActivateTexture( u32 t, CachedTexture *texture );
|
void TextureCache_ActivateTexture( u32 t, CachedTexture *texture );
|
||||||
void TextureCache_ActivateNoise( u32 t );
|
void TextureCache_ActivateNoise( u32 t );
|
||||||
void TextureCache_ActivateDummy( u32 t );
|
void TextureCache_ActivateDummy( u32 t );
|
||||||
BOOL TextureCache_Verify();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user