Remove path to trust application flushes on coherent maps. Closes #2372

* We used to allow applications to call vkFlushMappedMemoryRanges on coherent
  memory to manually annotate regions of memory that are changed in persistent
  maps, thus avoiding the overhead of RenderDoc needing to check for changes on
  each submit.
* Unfortunately this means that if the application calls flush wrongly then
  changes will no longer appear, even though the application was completely
  correct, if misleading, since by the spec behaviour vkFlushMappedMemoryRanges
  is a no-op on coherent memory so incorrect calls to it make no difference.
* Since applications making use of this are rare or non-existant we just remove
  the optimisation.
This commit is contained in:
baldurk committed 2021-09-23 17:37:26 +01:00
1 parent 42fcc3820d
commit b4e4fed40f
4 files changed
+2 -7

No files matched your search

-1
View File
@@ -1136,7 +1136,6 @@ struct MemMapState
VkDeviceSize mapOffset = 0, mapSize = 0;
bool dedicated = false;
bool needRefData = false;
bool mapFlushed = false;
bool mapCoherent = false;
bool readbackOnGPU = false;
// pointer to base of memory, may not be valid until after mapOffset bytes
@@ -1011,7 +1011,7 @@ void WrappedVulkan::CaptureQueueSubmit(VkQueue queue,
SCOPED_LOCK(state.mrLock);
// potential persistent map
if(state.mapCoherent && state.mappedPtr && !state.mapFlushed)
if(state.mapCoherent && state.mappedPtr)
{
// only need to flush memory that could affect this submitted batch of work, or if there are
// BDA buffers bound (as we can't track those!)
@@ -797,7 +797,6 @@ VkResult WrappedVulkan::vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDevic
state.mapOffset = offset;
state.mapSize = size == VK_WHOLE_SIZE ? (memrecord->Length - offset)
: RDCMIN(memrecord->Length - offset, size);
state.mapFlushed = false;
*ppData = realData + misalignedOffset;
@@ -1185,9 +1184,6 @@ void WrappedVulkan::InternalFlushMemoryRange(VkDevice device, const VkMappedMemo
MemMapState *state = record->memMapState;
if(!internalFlush)
state->mapFlushed = true;
if(state->mappedPtr == NULL)
{
RDCERR("Flushing memory %s that isn't currently mapped", ToStr(memid).c_str());