mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Fix initial state crashes for images in external queues. Closes #1226
This commit is contained in:
@@ -105,10 +105,6 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
return Prepare_SparseInitialState((WrappedVkImage *)res);
|
||||
}
|
||||
|
||||
VkDevice d = GetDev();
|
||||
// INITSTATEBATCH
|
||||
VkCommandBuffer cmd = GetNextCmd();
|
||||
|
||||
VkCommandBuffer extQCmd = VK_NULL_HANDLE;
|
||||
|
||||
ImageLayouts *layout = NULL;
|
||||
@@ -125,6 +121,10 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
return true;
|
||||
}
|
||||
|
||||
VkDevice d = GetDev();
|
||||
// INITSTATEBATCH
|
||||
VkCommandBuffer cmd = GetNextCmd();
|
||||
|
||||
if(layout->queueFamilyIndex != m_QueueFamilyIdx)
|
||||
{
|
||||
// get a command buffer for giving up ownership before the copy and acquiring it afterwards.
|
||||
@@ -1009,22 +1009,25 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
|
||||
// during writing, we already have the memory copied off - we just need to map it.
|
||||
if(ser.IsWriting())
|
||||
{
|
||||
mappedMem = initContents.mem;
|
||||
vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), initContents.mem.offs,
|
||||
initContents.mem.size, 0, (void **)&Contents);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
if(initContents.mem.mem != VK_NULL_HANDLE)
|
||||
{
|
||||
mappedMem = initContents.mem;
|
||||
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,
|
||||
};
|
||||
// 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);
|
||||
vkr = ObjDisp(d)->InvalidateMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
}
|
||||
}
|
||||
else if(IsReplayingAndReading() && !ser.IsErrored())
|
||||
{
|
||||
@@ -1081,7 +1084,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
|
||||
|
||||
// if we're handling a device memory object, we're done - we note the memory object to delete at
|
||||
// the end of the program, and store the buffer to copy off in Apply
|
||||
if(IsReplayingAndReading())
|
||||
if(IsReplayingAndReading() && ContentsSize > 0)
|
||||
{
|
||||
ResourceId liveid = GetResourceManager()->GetLiveID(id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user