mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 16:06:31 +00:00
Don't try to reset states for images with no memory bound
* Normally such images wouldn't be in the capture at all since there's no way to reference them until after their memory is bound, but with "Ref all resources" it's possible.
This commit is contained in:
@@ -294,8 +294,14 @@ void VulkanResourceManager::SerialiseImageStates(SerialiserType &ser,
|
||||
if(state.newLayout == VK_IMAGE_LAYOUT_UNDEFINED)
|
||||
state.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
t.subresourceRange = state.subresourceRange;
|
||||
barriers.push_back(t);
|
||||
vec.push_back(make_rdcpair(liveid, state));
|
||||
|
||||
auto stit = states.find(liveid);
|
||||
|
||||
if(stit == states.end() || stit->second.memoryBound)
|
||||
{
|
||||
barriers.push_back(t);
|
||||
vec.push_back(make_rdcpair(liveid, state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1330,6 +1330,7 @@ struct ImageLayouts
|
||||
VkExtent3D extent;
|
||||
VkFormat format;
|
||||
VkImageType imageType;
|
||||
bool memoryBound = false;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ImageLayouts);
|
||||
|
||||
@@ -952,6 +952,8 @@ bool WrappedVulkan::Serialise_vkBindImageMemory(SerialiserType &ser, VkDevice de
|
||||
|
||||
ObjDisp(device)->BindImageMemory(Unwrap(device), Unwrap(image), Unwrap(memory), memoryOffset);
|
||||
|
||||
m_ImageLayouts[GetResID(image)].memoryBound = true;
|
||||
|
||||
GetReplay()->GetResourceDesc(memOrigId).derivedResources.push_back(resOrigId);
|
||||
GetReplay()->GetResourceDesc(resOrigId).parentResources.push_back(memOrigId);
|
||||
|
||||
@@ -984,6 +986,14 @@ VkResult WrappedVulkan::vkBindImageMemory(VkDevice device, VkImage image, VkDevi
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
ImageLayouts *layout = NULL;
|
||||
{
|
||||
SCOPED_LOCK(m_ImageLayoutsLock);
|
||||
layout = &m_ImageLayouts[GetResID(image)];
|
||||
}
|
||||
|
||||
layout->memoryBound = true;
|
||||
|
||||
// memory object bindings are immutable and must happen before creation or use,
|
||||
// so this can always go into the record, even if a resource is created and bound
|
||||
// to memory mid-frame
|
||||
@@ -2014,6 +2024,8 @@ bool WrappedVulkan::Serialise_vkBindImageMemory2(SerialiserType &ser, VkDevice d
|
||||
if(!ok)
|
||||
return false;
|
||||
|
||||
m_ImageLayouts[GetResID(bindInfo.image)].memoryBound = true;
|
||||
|
||||
GetReplay()->GetResourceDesc(memOrigId).derivedResources.push_back(resOrigId);
|
||||
GetReplay()->GetResourceDesc(resOrigId).parentResources.push_back(memOrigId);
|
||||
|
||||
@@ -2055,6 +2067,14 @@ VkResult WrappedVulkan::vkBindImageMemory2(VkDevice device, uint32_t bindInfoCou
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
ImageLayouts *layout = NULL;
|
||||
{
|
||||
SCOPED_LOCK(m_ImageLayoutsLock);
|
||||
layout = &m_ImageLayouts[imgrecord->GetResourceID()];
|
||||
}
|
||||
|
||||
layout->memoryBound = true;
|
||||
|
||||
// memory object bindings are immutable and must happen before creation or use,
|
||||
// so this can always go into the record, even if a resource is created and bound
|
||||
// to memory mid-frame
|
||||
|
||||
@@ -449,6 +449,7 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(SerialiserType &ser, VkDevice
|
||||
m_ImageLayouts[liveId].extent = iminfo.extent;
|
||||
m_ImageLayouts[liveId].format = iminfo.format;
|
||||
m_ImageLayouts[liveId].imageType = iminfo.type;
|
||||
m_ImageLayouts[liveId].memoryBound = true;
|
||||
|
||||
m_ImageLayouts[liveId].subresourceStates.clear();
|
||||
m_ImageLayouts[liveId].subresourceStates.push_back(ImageRegionState(
|
||||
@@ -586,6 +587,7 @@ void WrappedVulkan::WrapAndProcessCreatedSwapchain(VkDevice device,
|
||||
SCOPED_LOCK(m_ImageLayoutsLock);
|
||||
m_ImageLayouts[imid].format = pCreateInfo->imageFormat;
|
||||
m_ImageLayouts[imid].imageType = VK_IMAGE_TYPE_2D;
|
||||
m_ImageLayouts[imid].memoryBound = true;
|
||||
|
||||
m_ImageLayouts[imid].subresourceStates.clear();
|
||||
m_ImageLayouts[imid].subresourceStates.push_back(ImageRegionState(
|
||||
|
||||
Reference in New Issue
Block a user