Also be sure to update refData whenever flushing a second time

This commit is contained in:
baldurk
2016-01-24 20:57:11 +01:00
parent c0717042de
commit 459883550d
2 changed files with 11 additions and 6 deletions
+1
View File
@@ -714,6 +714,7 @@ void WrappedVulkan::FinishCapture()
{
Serialiser::FreeAlignedBuffer((*it)->memMapState->refData);
(*it)->memMapState->refData = NULL;
(*it)->memMapState->needRefData = false;
}
}
}
@@ -489,11 +489,17 @@ bool WrappedVulkan::Serialise_vkFlushMappedMemoryRanges(
// if we need to save off this serialised buffer as reference for future comparison,
// do so now. See the call to vkFlushMappedMemoryRanges in WrappedVulkan::vkQueueSubmit()
if(m_State >= WRITING && state->needRefData && !state->refData)
if(m_State >= WRITING && state->needRefData)
{
// if we're in this case, the range should be for the whole memory region.
RDCASSERT(memOffset == 0 && memSize == state->mapSize);
if(!state->refData)
{
// if we're in this case, the range should be for the whole memory region.
RDCASSERT(memOffset == 0 && memSize == state->mapSize);
// allocate ref data so we can compare next time to minimise serialised data
state->refData = Serialiser::AllocAlignedBuffer((size_t)state->mapSize);
}
// it's no longer safe to use state->mappedPtr, we need to save *precisely* what
// was serialised. We do this by copying out of the serialiser since we know this
// memory is not changing
@@ -501,9 +507,7 @@ bool WrappedVulkan::Serialise_vkFlushMappedMemoryRanges(
byte *serialisedData = localSerialiser->GetRawPtr(offs);
// allocate ref data so we can compare next time to minimise serialised data
state->refData = Serialiser::AllocAlignedBuffer((size_t)state->mapSize);
memcpy(state->refData, serialisedData, (size_t)state->mapSize);
memcpy(state->refData, serialisedData + (size_t)memOffset, (size_t)memSize);
}
if(m_State < WRITING)