summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-09-13 08:21:35 +0000
committerhrydgard <hrydgard@gmail.com>2009-09-13 08:21:35 +0000
commit700f2ff694a67b21272b81a7ca80ba5572e794d9 (patch)
tree1b30e220aac51ed530d94bc110985cf3f90cba94 /Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
parent52ea8a0fd10f6f4103befb091c1fdc20c2caf8f7 (diff)
Lots of code and warning cleanup. OGL/D3D: Moved to a shared config class in VideoCommon. This lets VideoCommon code read the config without ugly hacks. Fixed various config race conditions by keeping a copy (g_ActiveConfig) of the g_Config struct which is updated once per frame.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4256 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
index 1d983cdcc1..a855f00094 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
@@ -48,7 +48,8 @@ void TextureCache::TCacheEntry::Destroy(bool shutdown)
if (texture)
texture->Release();
texture = 0;
- if (!isRenderTarget && !shutdown) {
+ if (!isRenderTarget && !shutdown)
+ {
u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(addr + hashoffset*4);
if (ptr && *ptr == hash)
*ptr = oldpixel;
@@ -58,7 +59,7 @@ void TextureCache::TCacheEntry::Destroy(bool shutdown)
void TextureCache::Init()
{
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
- TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter);
+ TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
}
void TextureCache::Invalidate(bool shutdown)
@@ -71,16 +72,14 @@ void TextureCache::Invalidate(bool shutdown)
void TextureCache::Shutdown()
{
Invalidate(true);
-
FreeMemoryPages(temp, TEMP_SIZE);
temp = NULL;
}
void TextureCache::Cleanup()
{
- TexCache::iterator iter=textures.begin();
-
- while(iter != textures.end())
+ TexCache::iterator iter = textures.begin();
+ while (iter != textures.end())
{
if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second.frameCount)
{
@@ -138,14 +137,14 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
u32 tex_hash = 0;
u32 texID = address;
- if (g_Config.bDumpTextures || g_Config.bSafeTextureCache)
+ if (g_ActiveConfig.bDumpTextures || g_ActiveConfig.bSafeTextureCache)
{
tex_hash = hash_value;
if ((format == GX_TF_C4) || (format == GX_TF_C8) || (format == GX_TF_C14X2))
{
u32 tlutHash = TexDecoder_GetTlutHash(&texMem[tlutaddr], (format == GX_TF_C4) ? 32 : 128);
tex_hash ^= tlutHash;
- if (g_Config.bSafeTextureCache)
+ if (g_ActiveConfig.bSafeTextureCache)
texID ^= tlutHash;
}
}
@@ -154,7 +153,6 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
if (iter != textures.end())
{
TCacheEntry &entry = iter->second;
-
if (entry.isRenderTarget || ((address == entry.addr) && (hash_value == entry.hash)))
{
entry.frameCount = frameCount;
@@ -163,7 +161,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
return &entry;
}
lastTexture[stage] = entry.texture;
- D3D::SetTexture( stage, entry.texture );
+ D3D::SetTexture(stage, entry.texture);
return &entry;
}
else
@@ -232,7 +230,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
entry.fmt = format;
entry.mode = bpmem.tex[stage > 3].texMode0[stage & 3];
- if (g_Config.bDumpTextures)
+ if (g_ActiveConfig.bDumpTextures)
{ // dump texture to file
char szTemp[MAX_PATH];
@@ -262,7 +260,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
SETSTAT(stats.numTexturesAlive, (int)textures.size());
//Set the texture!
- D3D::SetTexture( stage, entry.texture );
+ D3D::SetTexture(stage, entry.texture);
lastTexture[stage] = entry.texture;