From a767de8e09a918ea04391374b41d8d556b898b90 Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Sat, 29 Jan 2011 17:04:09 +0000 Subject: [PATCH] some fixes to dlist caching, now most of the remaining glitches should be fixed git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6970 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/DLCache.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/Src/DLCache.cpp b/Source/Core/VideoCommon/Src/DLCache.cpp index 47c8041105..35a3ab0ddd 100644 --- a/Source/Core/VideoCommon/Src/DLCache.cpp +++ b/Source/Core/VideoCommon/Src/DLCache.cpp @@ -67,12 +67,16 @@ struct ReferencedDataRegion start_address(NULL), size(0), MustClean(false), + ReferencedArray(-1), + ReferencedArrayStride(0), NextRegion(NULL) {} u64 hash; u8* start_address; u32 size; bool MustClean; + u32 ReferencedArray; + u32 ReferencedArrayStride; ReferencedDataRegion* NextRegion; int IntersectsMemoryRange(u8* range_address, u32 range_size) @@ -142,7 +146,7 @@ struct CachedDisplayList BufferCount++; } - void InsertOverlapingRegion(u8* RegionStartAddress, u32 Size) + void InsertOverlapingRegion(u8* RegionStartAddress, u32 Size,int referencedArray,int referencedArrayStride) { ReferencedDataRegion* NewRegion = FindOverlapingRegion(RegionStartAddress, Size); if(NewRegion) @@ -168,6 +172,9 @@ struct CachedDisplayList NewRegion->size = Size; NewRegion->start_address = RegionStartAddress; NewRegion->hash = GetHash64(RegionStartAddress, Size, DL_HASH_STEPS); + NewRegion->ReferencedArray = referencedArray; + NewRegion->ReferencedArrayStride = referencedArrayStride; + InsertRegion(NewRegion); } } @@ -179,6 +186,10 @@ struct CachedDisplayList { if(Current->hash) { + if(Current->ReferencedArray != -1 && (cached_arraybases[Current->ReferencedArray] != Current->start_address || arraystrides[Current->ReferencedArray] != Current->ReferencedArrayStride)) + { + return false; + } if(Current->hash != GetHash64(Current->start_address, Current->size, DL_HASH_STEPS)) return false; } @@ -571,7 +582,7 @@ bool CompileAndRunDisplayList(u32 address, int size, CachedDisplayList *dl) { u8* saddr = cached_arraybases[i]; int arraySize = arraystrides[i] * ((tc[i] == 2)? numVertices : ((numVertices < 1024)? 2 * numVertices : numVertices)); - dl->InsertOverlapingRegion(saddr, arraySize); + dl->InsertOverlapingRegion(saddr, arraySize,i,arraystrides[i]); } } }