From c9dd11c80333238e567d50818d8e2762ca1de0ba Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Mon, 30 Aug 2010 15:18:43 +0000 Subject: [PATCH] some fixes for dlist, now is configurable in the video config section, still not in the gui, disabled by default till a fix for segfaults in linux and geometry problems in some games git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6155 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/DLCache.cpp | 44 ++++++++++++++------ Source/Core/VideoCommon/Src/VertexLoader.cpp | 3 +- Source/Core/VideoCommon/Src/VideoConfig.cpp | 4 +- Source/Core/VideoCommon/Src/VideoConfig.h | 1 + 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Source/Core/VideoCommon/Src/DLCache.cpp b/Source/Core/VideoCommon/Src/DLCache.cpp index f542952c85..9228c28e52 100644 --- a/Source/Core/VideoCommon/Src/DLCache.cpp +++ b/Source/Core/VideoCommon/Src/DLCache.cpp @@ -37,6 +37,7 @@ #include "ABI.h" #include "DLCache.h" +#include "VideoConfig.h" #define DL_CODE_CACHE_SIZE (1024*1024*16) extern int frameCount; @@ -497,11 +498,9 @@ void ProgressiveCleanup() // NOTE - outside the namespace on purpose. bool HandleDisplayList(u32 address, u32 size) { - // Disable display list caching since the benefit isn't much to write home about - // right now... - //Fixed DlistCaching now is fully functional benefits still marginal but when vertex data is stored here the story will be diferent :) - //to test remove the next line; - + //Fixed DlistCaching now is fully functional still some things to workout + if(!g_ActiveConfig.bDlistCahchingEnable) + return false; if(size == 0) return false; u64 dl_id = DLCache::CreateMapId(address, size); DLCache::DLMap::iterator iter = DLCache::dl_map.find(dl_id); @@ -512,23 +511,41 @@ bool HandleDisplayList(u32 address, u32 size) DLCache::CachedDisplayList &dl = iter->second; if (dl.uncachable) { - // We haven't compiled it - let's return false so it gets - // interpreted. - return false; + dl.check--; + if(dl.check <= 0) + { + dl.pass = DLCache::DLPASS_ANALYZE; + dl.uncachable = false; + dl.check = dl.next_check; + } + else + { + return false; + } } // Got one! And it's been compiled too, so let's run the compiled code! switch (dl.pass) { case DLCache::DLPASS_ANALYZE: - PanicAlert("DLPASS_ANALYZE - should have been done the first pass"); + if (DLCache::AnalyzeAndRunDisplayList(address, size, &dl)) { + dl.dl_hash = GetHash64(Memory_GetPtr(address), size,0); + dl.pass = DLCache::DLPASS_COMPILE; + dl.check = 1; + dl.next_check = 1; + return true; + } else { + dl.uncachable = true; + return true; // don't also interpret the list. + } break; case DLCache::DLPASS_COMPILE: // First, check that the hash is the same as the last time. if (dl.dl_hash != GetHash64(Memory_GetPtr(address), size,0)) { // PanicAlert("uncachable %08x", address); - dl.uncachable = true; + dl.uncachable = true; + dl.check = 60; return false; } DLCache::CompileAndRunDisplayList(address, size, &dl); @@ -543,6 +560,7 @@ bool HandleDisplayList(u32 address, u32 size) if (dl.dl_hash != GetHash64(Memory_GetPtr(address), size,0)) { dl.uncachable = true; + dl.check = 60; DLCache::VdataMap::iterator viter = dl.Vdata.begin(); while (viter != dl.Vdata.end()) { @@ -554,9 +572,9 @@ bool HandleDisplayList(u32 address, u32 size) return false; } dl.check = dl.next_check; - dl.next_check *= 2; - if (dl.next_check > 1024) - dl.next_check = 1024; + /*dl.next_check ++; + if (dl.next_check > 60) + dl.next_check = 60;*/ } dl.frame_count= frameCount; u8 *old_datareader = g_pVideoData; diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 072e239d9e..285f7f8b0f 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -732,7 +732,8 @@ void VertexLoader::RunCompiledVertices(int vtx_attr_group, int primitive, int co VertexManager::Flush(); memcpy_gc(VertexManager::s_pCurBufferPointer, Data, native_stride * count); VertexManager::s_pCurBufferPointer += native_stride * count; - VertexManager::AddVertices(primitive, count); + DataSkip(count * m_VertexSize); + VertexManager::AddVertices(primitive, count); } diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 5de291c0fa..9cd7be7dcc 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -89,7 +89,8 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x) iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); - iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); + iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, false); + iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCahchingEnable); iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false); iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); @@ -198,6 +199,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader); iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); + iniFile.Set("Hacks", "DlistCachingEnable", bDlistCahchingEnable); iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 70e8861eba..089771ca56 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -112,6 +112,7 @@ struct VideoConfig // Hacks bool bEFBAccessEnable; + bool bDlistCahchingEnable; bool bEFBCopyDisable; // should reverse polarity of this one :) true=disabled can be confusing bool bOSDHotKey; bool bHack;