experimental commit: simplify even more the params. please test and if theres something wrong will revert asap

thanks for the comments in the prev commit they make my re think the approach.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5136 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-02-26 22:14:29 +00:00
parent 02189ec5e0
commit 6b1ca64428
5 changed files with 18 additions and 51 deletions

View File

@ -63,8 +63,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
//Safe texture cache params //Safe texture cache params
iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,37); iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512);
iniFile.Get("Settings", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,1024);
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
@ -132,9 +131,7 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache, false); iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
//Safe texture cache params //Safe texture cache params
if (iniFile.Exists("Video", "SafeTextureCacheColorSamples")) if (iniFile.Exists("Video", "SafeTextureCacheColorSamples"))
iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,37); iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512);
if (iniFile.Exists("Video", "SafeTextureCacheTlutMaxSize"))
iniFile.Get("Video", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,1024);
if (iniFile.Exists("Video", "MSAA")) if (iniFile.Exists("Video", "MSAA"))
iniFile.Get("Video", "MSAA", &iMultisampleMode, 0); iniFile.Get("Video", "MSAA", &iMultisampleMode, 0);
@ -169,7 +166,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache); iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
//safe texture cache params //safe texture cache params
iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
iniFile.Set("Settings", "SafeTextureCacheTlutMaxSize", iSafeTextureCache_TlutMaxSize);
iniFile.Set("Settings", "ShowFPS", bShowFPS); iniFile.Set("Settings", "ShowFPS", bShowFPS);
iniFile.Set("Settings", "OverlayStats", bOverlayStats); iniFile.Set("Settings", "OverlayStats", bOverlayStats);

View File

@ -119,8 +119,7 @@ struct VideoConfig
bool bCopyEFBToTexture; bool bCopyEFBToTexture;
bool bCopyEFBScaled; bool bCopyEFBScaled;
bool bSafeTextureCache; bool bSafeTextureCache;
int iSafeTextureCache_ColorSamples; int iSafeTextureCache_ColorSamples;
int iSafeTextureCache_TlutMaxSize;
bool bFIFOBPhack; bool bFIFOBPhack;
int iPhackvalue; int iPhackvalue;
bool bPhackvalue1, bPhackvalue2; bool bPhackvalue1, bPhackvalue2;

View File

@ -96,13 +96,13 @@ struct TabDirect3D : public W32Util::Tab
Button_SetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK), g_Config.bWidescreenHack); Button_SetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK), g_Config.bWidescreenHack);
Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache); Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache);
if(g_Config.iSafeTextureCache_ColorSamples == 0 && g_Config.iSafeTextureCache_TlutMaxSize == 0) if(g_Config.iSafeTextureCache_ColorSamples == 0)
{ {
Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE), true); Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE), true);
} }
else else
{ {
if(g_Config.iSafeTextureCache_ColorSamples > 36 && g_Config.iSafeTextureCache_TlutMaxSize > 4095) if(g_Config.iSafeTextureCache_ColorSamples > 128)
{ {
Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL), true); Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL), true);
} }
@ -160,32 +160,23 @@ struct TabDirect3D : public W32Util::Tab
g_Config.RenderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false; g_Config.RenderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false;
if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE))) if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE)))
{ {
g_Config.iSafeTextureCache_ColorSamples = 0; g_Config.iSafeTextureCache_ColorSamples = 0;
g_Config.iSafeTextureCache_TlutMaxSize = 0;
} }
else else
{ {
if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL))) if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL)))
{ {
if(g_Config.iSafeTextureCache_ColorSamples < 37) if(g_Config.iSafeTextureCache_ColorSamples < 512)
{ {
g_Config.iSafeTextureCache_ColorSamples = 37; g_Config.iSafeTextureCache_ColorSamples = 512;
} }
if(g_Config.iSafeTextureCache_TlutMaxSize < 4096)
{
g_Config.iSafeTextureCache_TlutMaxSize = 4096;
}
} }
else else
{ {
if(g_Config.iSafeTextureCache_ColorSamples > 36 || g_Config.iSafeTextureCache_ColorSamples == 0) if(g_Config.iSafeTextureCache_ColorSamples > 128 || g_Config.iSafeTextureCache_ColorSamples == 0)
{ {
g_Config.iSafeTextureCache_ColorSamples = 8; g_Config.iSafeTextureCache_ColorSamples = 128;
} }
if(g_Config.iSafeTextureCache_TlutMaxSize > 1024 || g_Config.iSafeTextureCache_TlutMaxSize == 0)
{
g_Config.iSafeTextureCache_TlutMaxSize = 1024;
}
} }
} }
g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());

View File

@ -156,7 +156,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures) if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures)
{ {
texHash = TexDecoder_GetHash64(ptr,TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format),g_ActiveConfig.iSafeTextureCache_ColorSamples);
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2)) if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
{ {
// WARNING! texID != address now => may break CopyRenderTargetToTexture (cf. TODO up) // WARNING! texID != address now => may break CopyRenderTargetToTexture (cf. TODO up)
@ -166,23 +166,13 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
// each other stored in a single texture, and uses the palette to make different characters // each other stored in a single texture, and uses the palette to make different characters
// visible or invisible. Thus, unless we want to recreate the textures for every drawn character, // visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
// we must make sure that texture with different tluts get different IDs. // we must make sure that texture with different tluts get different IDs.
int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); u64 tlutHash = TexDecoder_GetHash64(&texMem[tlutaddr], TexDecoder_GetPaletteSize(tex_format),g_ActiveConfig.iSafeTextureCache_ColorSamples);
texHash = TexDecoder_GetHash64(ptr,tempsize,0);
tempsize = TexDecoder_GetPaletteSize(tex_format);
tempsize = (g_ActiveConfig.iSafeTextureCache_TlutMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_TlutMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_TlutMaxSize : tempsize;
u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,0);
texHash ^= tlutHash; texHash ^= tlutHash;
if (g_ActiveConfig.bSafeTextureCache) if (g_ActiveConfig.bSafeTextureCache)
{ {
texID = texID ^ tlutHash; texID = texID ^ ((u32)(tlutHash & 0xFFFFFFFF)) ^ ((u32)((tlutHash >> 32) & 0xFFFFFFFF));
} }
} }
else
{
int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format);
texHash = TexDecoder_GetHash64(ptr, tempsize,g_ActiveConfig.iSafeTextureCache_ColorSamples);
}
if (g_ActiveConfig.bSafeTextureCache) if (g_ActiveConfig.bSafeTextureCache)
hash_value = texHash; hash_value = texHash;
} }

View File

@ -265,6 +265,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
FullFormat = (tex_format | (tlutfmt << 16)); FullFormat = (tex_format | (tlutfmt << 16));
if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures) if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures)
{ {
texHash = TexDecoder_GetHash64(ptr,TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format),g_ActiveConfig.iSafeTextureCache_ColorSamples);
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2)) if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
{ {
// WARNING! texID != address now => may break CopyRenderTargetToTexture (cf. TODO up) // WARNING! texID != address now => may break CopyRenderTargetToTexture (cf. TODO up)
@ -274,23 +275,13 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
// each other stored in a single texture, and uses the palette to make different characters // each other stored in a single texture, and uses the palette to make different characters
// visible or invisible. Thus, unless we want to recreate the textures for every drawn character, // visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
// we must make sure that texture with different tluts get different IDs. // we must make sure that texture with different tluts get different IDs.
int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); u64 tlutHash = TexDecoder_GetHash64(&texMem[tlutaddr], TexDecoder_GetPaletteSize(tex_format),g_ActiveConfig.iSafeTextureCache_ColorSamples);
texHash = TexDecoder_GetHash64(ptr,tempsize,0);
tempsize = TexDecoder_GetPaletteSize(tex_format);
tempsize = (g_ActiveConfig.iSafeTextureCache_TlutMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_TlutMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_TlutMaxSize : tempsize;
u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,0);
texHash ^= tlutHash; texHash ^= tlutHash;
if (g_ActiveConfig.bSafeTextureCache) if (g_ActiveConfig.bSafeTextureCache)
{ {
texID = texID ^ tlutHash; texID = texID ^ ((u32)(tlutHash & 0xFFFFFFFF)) ^ ((u32)((tlutHash >> 32) & 0xFFFFFFFF));
} }
} }
else
{
int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format);
texHash = TexDecoder_GetHash64(ptr, tempsize,g_ActiveConfig.iSafeTextureCache_ColorSamples);
}
if (g_ActiveConfig.bSafeTextureCache) if (g_ActiveConfig.bSafeTextureCache)
hash_value = texHash; hash_value = texHash;
} }