mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-18 16:00:48 +00:00
Fixes for incorrect aspect/aspectFlag being used in initial states
This commit is contained in:
@@ -968,13 +968,21 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
VkExtent3D extent = layout->extent;
|
||||
|
||||
VkImageAspect aspect = VK_IMAGE_ASPECT_COLOR;
|
||||
VkImageAspectFlags aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
if (IsDepthStencilFormat(layout->format))
|
||||
{
|
||||
aspect = VK_IMAGE_ASPECT_DEPTH;
|
||||
aspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
}
|
||||
|
||||
VkImageMemoryBarrier srcimBarrier = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL,
|
||||
0, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
im->real.As<VkImage>(),
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, (uint32_t)layout->arraySize }
|
||||
{ aspectFlags, 0, 1, 0, (uint32_t)layout->arraySize }
|
||||
};
|
||||
|
||||
// loop over every mip, copying it to the appropriate point in the buffer
|
||||
@@ -982,12 +990,12 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
{
|
||||
VkBufferImageCopy region = {
|
||||
0, 0, 0,
|
||||
{ VK_IMAGE_ASPECT_COLOR, (uint32_t)m, 0, (uint32_t)layout->arraySize },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)layout->arraySize },
|
||||
{ 0, 0, 0, },
|
||||
extent,
|
||||
};
|
||||
|
||||
VkImageSubresource sub = { VK_IMAGE_ASPECT_COLOR, (uint32_t)m, 0 };
|
||||
VkImageSubresource sub = { aspect, (uint32_t)m, 0 };
|
||||
VkSubresourceLayout sublayout;
|
||||
|
||||
vkr = ObjDisp(d)->GetImageSubresourceLayout(Unwrap(d), im->real.As<VkImage>(), &sub, &sublayout);
|
||||
@@ -1401,6 +1409,12 @@ bool WrappedVulkan::Serialise_InitialState(WrappedVkRes *res)
|
||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
};
|
||||
|
||||
if (IsDepthStencilFormat(m_CreationInfo.m_Image[liveim->id].format))
|
||||
{
|
||||
imInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
}
|
||||
|
||||
|
||||
VkImage im = VK_NULL_HANDLE;
|
||||
|
||||
vkr = ObjDisp(d)->CreateImage(Unwrap(d), &imInfo, &im);
|
||||
@@ -1433,13 +1447,22 @@ bool WrappedVulkan::Serialise_InitialState(WrappedVkRes *res)
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
VkExtent3D extent = imInfo.extent;
|
||||
|
||||
|
||||
VkImageAspect aspect = VK_IMAGE_ASPECT_COLOR;
|
||||
VkImageAspectFlags aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
|
||||
if (IsDepthStencilFormat(m_CreationInfo.m_Image[liveim->id].format))
|
||||
{
|
||||
aspect = VK_IMAGE_ASPECT_DEPTH;
|
||||
aspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
}
|
||||
|
||||
VkImageMemoryBarrier srcimBarrier = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL,
|
||||
0, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
Unwrap(im),
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, imInfo.arraySize }
|
||||
{ aspectFlags, 0, 1, 0, imInfo.arraySize }
|
||||
};
|
||||
|
||||
// copy each mip individually
|
||||
@@ -1447,12 +1470,12 @@ bool WrappedVulkan::Serialise_InitialState(WrappedVkRes *res)
|
||||
{
|
||||
VkBufferImageCopy region = {
|
||||
0, 0, 0,
|
||||
{ VK_IMAGE_ASPECT_COLOR, m, 0, imInfo.arraySize },
|
||||
{ aspect, m, 0, imInfo.arraySize },
|
||||
{ 0, 0, 0, },
|
||||
extent,
|
||||
};
|
||||
|
||||
VkImageSubresource sub = { VK_IMAGE_ASPECT_COLOR, m, 0 };
|
||||
VkImageSubresource sub = { aspect, m, 0 };
|
||||
VkSubresourceLayout sublayout;
|
||||
|
||||
vkr = ObjDisp(d)->GetImageSubresourceLayout(Unwrap(d), Unwrap(im), &sub, &sublayout);
|
||||
@@ -1796,21 +1819,30 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
|
||||
|
||||
VkExtent3D extent = m_CreationInfo.m_Image[id].extent;
|
||||
|
||||
VkImageAspect aspect = VK_IMAGE_ASPECT_COLOR;
|
||||
VkImageAspectFlags aspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
|
||||
if (IsDepthStencilFormat(m_CreationInfo.m_Image[id].format))
|
||||
{
|
||||
aspect = VK_IMAGE_ASPECT_DEPTH;
|
||||
aspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
}
|
||||
|
||||
VkImageMemoryBarrier dstimBarrier = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL,
|
||||
0, 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
ToHandle<VkImage>(live),
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize }
|
||||
{ aspectFlags, 0, 1, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize }
|
||||
};
|
||||
|
||||
// loop over every mip
|
||||
for(int m=0; m < m_CreationInfo.m_Image[id].mipLevels; m++)
|
||||
{
|
||||
VkImageCopy region = {
|
||||
{ VK_IMAGE_ASPECT_COLOR, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ 0, 0, 0 },
|
||||
{ VK_IMAGE_ASPECT_COLOR, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ aspect, (uint32_t)m, 0, (uint32_t)m_CreationInfo.m_Image[id].arraySize },
|
||||
{ 0, 0, 0 },
|
||||
extent,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user