Force Rehash if length increases

This commit is contained in:
Luke Usher 2018-02-25 12:30:40 +00:00
parent 979c5c1598
commit d46a1ab27c
1 changed files with 6 additions and 2 deletions

View File

@ -283,9 +283,13 @@ bool XTL::VertexPatcher::ApplyCachedStream(VertexPatchDesc *pPatchDesc,
pCalculateData = (void*)GetDataFromXboxResource(pOrigVertexBuffer); pCalculateData = (void*)GetDataFromXboxResource(pOrigVertexBuffer);
} }
uint32_t uiHash = XXHash32::hash((void *)pCalculateData, uiLength, HASH_SEED); uint32_t uiHash = XXHash32::hash((void *)pCalculateData, pCachedStream->uiLength, HASH_SEED);
*pHash = uiHash; *pHash = uiHash;
if(uiHash == pCachedStream->uiHash)
// If the hash didn't change and the length didn't increase, use the cached stream
// If the length increased,we have more data then before and we must re-create the
// vertex buffer
if(uiHash == pCachedStream->uiHash && uiLength <= pCachedStream->uiLength)
{ {
// Take a while longer to check // Take a while longer to check
if(pCachedStream->uiCheckFrequency < 32*1024) if(pCachedStream->uiCheckFrequency < 32*1024)