mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add more missing Vulkan cache flushes
Missed these the first time around
This commit is contained in:
committed by
Baldur Karlsson
parent
79579b85b3
commit
4ab781ec8c
@@ -900,6 +900,18 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
|
||||
vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), initContents.mem.offs,
|
||||
initContents.mem.size, 0, (void **)&Contents);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
// invalidate the cpu cache for this memory range to avoid reading stale data
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||
NULL,
|
||||
Unwrap(mappedMem.mem),
|
||||
mappedMem.offs,
|
||||
mappedMem.size,
|
||||
};
|
||||
|
||||
vkr = ObjDisp(d)->InvalidateMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
}
|
||||
else if(IsReplayingAndReading() && !ser.IsErrored())
|
||||
{
|
||||
@@ -933,7 +945,24 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
|
||||
|
||||
// unmap the resource we mapped before - we need to do this on read and on write.
|
||||
if(!IsStructuredExporting(m_State) && mappedMem.mem != VK_NULL_HANDLE)
|
||||
{
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
// first ensure we flush the writes from the cpu to gpu memory
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||
NULL,
|
||||
Unwrap(mappedMem.mem),
|
||||
mappedMem.offs,
|
||||
mappedMem.size,
|
||||
};
|
||||
|
||||
vkr = ObjDisp(d)->FlushMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
}
|
||||
|
||||
ObjDisp(d)->UnmapMemory(Unwrap(d), Unwrap(mappedMem.mem));
|
||||
}
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
|
||||
@@ -441,6 +441,18 @@ bool WrappedVulkan::Serialise_SparseBufferInitialState(SerialiserType &ser, Reso
|
||||
vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), mappedMem.offs, mappedMem.size, 0,
|
||||
(void **)&Contents);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
// invalidate the cpu cache for this memory range to avoid reading stale data
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||
NULL,
|
||||
Unwrap(mappedMem.mem),
|
||||
mappedMem.offs,
|
||||
mappedMem.size,
|
||||
};
|
||||
|
||||
vkr = ObjDisp(d)->InvalidateMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
}
|
||||
else if(IsReplayingAndReading() && !ser.IsErrored())
|
||||
{
|
||||
@@ -477,7 +489,24 @@ bool WrappedVulkan::Serialise_SparseBufferInitialState(SerialiserType &ser, Reso
|
||||
|
||||
// unmap the resource we mapped before - we need to do this on read and on write.
|
||||
if(!IsStructuredExporting(m_State) && mappedMem.mem != VK_NULL_HANDLE)
|
||||
{
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
// first ensure we flush the writes from the cpu to gpu memory
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||
NULL,
|
||||
Unwrap(mappedMem.mem),
|
||||
mappedMem.offs,
|
||||
mappedMem.size,
|
||||
};
|
||||
|
||||
vkr = ObjDisp(d)->FlushMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
}
|
||||
|
||||
ObjDisp(d)->UnmapMemory(Unwrap(d), Unwrap(mappedMem.mem));
|
||||
}
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user