mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Fix image subresource order
When importing captures from v1.6 and before, the order that image subresource states are listed in the capture differs from the order expected in `ImageState`. This change sorts the subresources into the correct order before importing. Change-Id: I1bb1420bc79e39ba8e1fb2e932307a218878e1c2
This commit is contained in:
committed by
Baldur Karlsson
parent
fac4367cae
commit
bc56fd091d
@@ -320,7 +320,11 @@ void VulkanResourceManager::SerialiseImageStates(SerialiserType &ser,
|
||||
}
|
||||
|
||||
if(!subresourceStates.empty())
|
||||
{
|
||||
std::sort(subresourceStates.begin(), subresourceStates.end(),
|
||||
ImageSubresourceStateForRange::CompareRangeBegin);
|
||||
imageState.subresourceStates.FromArray(subresourceStates);
|
||||
}
|
||||
imageState.maxRefType = eFrameRef_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1317,6 +1317,30 @@ struct ImageSubresourceStateForRange
|
||||
{
|
||||
ImageSubresourceRange range;
|
||||
ImageSubresourceState state;
|
||||
inline static bool CompareRangeBegin(const ImageSubresourceStateForRange &x,
|
||||
const ImageSubresourceStateForRange &y)
|
||||
{
|
||||
const ImageSubresourceRange &rx = x.range;
|
||||
const ImageSubresourceRange &ry = y.range;
|
||||
|
||||
// Find the first (least significant) aspcet bit
|
||||
VkImageAspectFlags ax = *ImageAspectFlagIter::begin(rx.aspectMask);
|
||||
VkImageAspectFlags ay = *ImageAspectFlagIter::begin(ry.aspectMask);
|
||||
|
||||
if(ax == ay)
|
||||
{
|
||||
if(rx.baseMipLevel == ry.baseMipLevel)
|
||||
{
|
||||
if(rx.baseArrayLayer == ry.baseArrayLayer)
|
||||
{
|
||||
return rx.baseDepthSlice < ry.baseDepthSlice;
|
||||
}
|
||||
return rx.baseArrayLayer < ry.baseArrayLayer;
|
||||
}
|
||||
return rx.baseMipLevel < ry.baseMipLevel;
|
||||
}
|
||||
return ax < ay;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ImageSubresourceStateForRange);
|
||||
|
||||
Reference in New Issue
Block a user