mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-06 12:21:54 +00:00
Rename ImageRegionState members to match VkImageMemoryBarrier members
* This will let us re-use logic on either one in Record/MergeTransitions
This commit is contained in:
1 parent
5990b996e2
commit
12843544e2
5 files changed
+126
-126
No files matched your search
@@ -1627,7 +1627,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }
|
||||
};
|
||||
|
||||
m_pDriver->m_ImageLayouts[GetResID(m_OverlayImage)].subresourceStates[0].state = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
m_pDriver->m_ImageLayouts[GetResID(m_OverlayImage)].subresourceStates[0].newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
void *barrier = (void *)&trans;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
|
||||
// VKTODOMED handle getting the right origLayout for this mip, handle transitioning
|
||||
// multiple slices with different layouts etc
|
||||
VkImageLayout origLayout = layout->subresourceStates[0].state;
|
||||
VkImageLayout origLayout = layout->subresourceStates[0].newLayout;
|
||||
|
||||
// transition the real image into transfer-source
|
||||
srcimTrans.oldLayout = origLayout;
|
||||
@@ -736,7 +736,7 @@ void WrappedVulkan::Create_InitialState(ResourceId id, WrappedVkRes *live, bool
|
||||
|
||||
ImageLayouts &layouts = m_ImageLayouts[liveid];
|
||||
|
||||
if(layouts.subresourceStates[0].range.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
if(layouts.subresourceStates[0].subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
GetResourceManager()->SetInitialContents(id, VulkanResourceManager::InitialContentData(NULL, eInitialContents_ClearColorImage, NULL));
|
||||
else
|
||||
GetResourceManager()->SetInitialContents(id, VulkanResourceManager::InitialContentData(NULL, eInitialContents_ClearDepthStencilImage, NULL));
|
||||
@@ -804,7 +804,7 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
|
||||
VkImageMemoryBarrier barrier = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL,
|
||||
0, 0,
|
||||
m_ImageLayouts[id].subresourceStates[0].state, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
m_ImageLayouts[id].subresourceStates[0].newLayout, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
ToHandle<VkImage>(live),
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS },
|
||||
@@ -860,7 +860,7 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
|
||||
VkImageMemoryBarrier barrier = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL,
|
||||
0, 0,
|
||||
m_ImageLayouts[id].subresourceStates[0].state, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
m_ImageLayouts[id].subresourceStates[0].newLayout, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
ToHandle<VkImage>(live),
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS },
|
||||
@@ -944,7 +944,7 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *live, VulkanResourceManager
|
||||
dstimTrans.subresourceRange.baseMipLevel = m;
|
||||
|
||||
// VKTODOMED handle getting the right origLayout for this mip, handle multiple slices with different layouts etc
|
||||
VkImageLayout origLayout = m_ImageLayouts[id].subresourceStates[0].state;
|
||||
VkImageLayout origLayout = m_ImageLayouts[id].subresourceStates[0].newLayout;
|
||||
|
||||
// first transition the live image into destination optimal (the initial state
|
||||
// image is always and permanently in source optimal already).
|
||||
|
||||
@@ -30,9 +30,9 @@ void Serialiser::Serialise(const char *name, ImageRegionState &el)
|
||||
{
|
||||
ScopedContext scope(this, name, "ImageRegionState", 0, true);
|
||||
|
||||
Serialise("range", el.range);
|
||||
Serialise("prevstate", el.prevstate);
|
||||
Serialise("state", el.state);
|
||||
Serialise("range", el.subresourceRange);
|
||||
Serialise("prevstate", el.oldLayout);
|
||||
Serialise("state", el.newLayout);
|
||||
}
|
||||
|
||||
bool VulkanResourceManager::SerialisableResource(ResourceId id, VkResourceRecord *record)
|
||||
@@ -79,24 +79,24 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
if(it->first < id) continue;
|
||||
if(it->first != id) break;
|
||||
|
||||
if(it->second.range.aspectMask & t.subresourceRange.aspectMask)
|
||||
if(it->second.subresourceRange.aspectMask & t.subresourceRange.aspectMask)
|
||||
{
|
||||
// we've found a range that completely matches our region, doesn't matter if that's
|
||||
// a whole image and the transition is the whole image, or it's one subresource.
|
||||
// note that for images with only one array/mip slice (e.g. render targets) we'll never
|
||||
// really have to worry about the else{} branch
|
||||
if(it->second.range.baseMipLevel == t.subresourceRange.baseMipLevel &&
|
||||
it->second.range.mipLevels == nummips &&
|
||||
it->second.range.baseArrayLayer == t.subresourceRange.baseArrayLayer &&
|
||||
it->second.range.arraySize == numslices)
|
||||
if(it->second.subresourceRange.baseMipLevel == t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.mipLevels == nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer == t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.arraySize == numslices)
|
||||
{
|
||||
// verify
|
||||
//RDCASSERT(it->second.state == t.oldState);
|
||||
//RDCASSERT(it->second.state == t.oldLayout);
|
||||
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.oldLayout;
|
||||
it->second.state = t.newLayout;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
done = true;
|
||||
break;
|
||||
@@ -113,17 +113,17 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
// range could be sparse, but that's OK as we only break out of the loop once we go past the whole
|
||||
// aspect. Any subresources that don't match the range, after the split, will fail to meet any
|
||||
// of the handled cases, so we'll just continue processing.
|
||||
if(it->second.range.mipLevels == 1 &&
|
||||
it->second.range.arraySize == 1 &&
|
||||
it->second.range.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.range.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.range.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.range.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
if(it->second.subresourceRange.mipLevels == 1 &&
|
||||
it->second.subresourceRange.arraySize == 1 &&
|
||||
it->second.subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.oldLayout;
|
||||
it->second.state = t.newLayout;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -134,14 +134,14 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
// case, so we know that the transition doesn't cover the whole range.
|
||||
// Also, if we've already done the split this case won't be hit and we'll either fall into
|
||||
// the case above, or we'll finish as we've covered the whole transition.
|
||||
else if(it->second.range.mipLevels > 1 || it->second.range.arraySize > 1)
|
||||
else if(it->second.subresourceRange.mipLevels > 1 || it->second.subresourceRange.arraySize > 1)
|
||||
{
|
||||
pair<ResourceId, ImageRegionState> existing = *it;
|
||||
|
||||
// remember where we were in the array, as after this iterators will be
|
||||
// invalidated.
|
||||
size_t offs = it - trans.begin();
|
||||
size_t count = it->second.range.mipLevels * it->second.range.arraySize;
|
||||
size_t count = it->second.subresourceRange.mipLevels * it->second.subresourceRange.arraySize;
|
||||
|
||||
// only insert count-1 as we want count entries total - one per subresource
|
||||
trans.insert(it, count-1, existing);
|
||||
@@ -152,12 +152,12 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
|
||||
for(size_t i=0; i < count; i++)
|
||||
{
|
||||
it->second.range.mipLevels = 1;
|
||||
it->second.range.arraySize = 1;
|
||||
it->second.subresourceRange.mipLevels = 1;
|
||||
it->second.subresourceRange.arraySize = 1;
|
||||
|
||||
// slice-major
|
||||
it->second.range.baseArrayLayer = uint32_t(i / existing.second.range.mipLevels);
|
||||
it->second.range.baseMipLevel = uint32_t(i % existing.second.range.mipLevels);
|
||||
it->second.subresourceRange.baseArrayLayer = uint32_t(i / existing.second.subresourceRange.mipLevels);
|
||||
it->second.subresourceRange.baseMipLevel = uint32_t(i % existing.second.subresourceRange.mipLevels);
|
||||
it++;
|
||||
}
|
||||
|
||||
@@ -166,15 +166,15 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
|
||||
// the loop will continue after this point and look at the next subresources
|
||||
// so we need to check to see if the first subresource lies in the range here
|
||||
if(it->second.range.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.range.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.range.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.range.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
if(it->second.subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.oldLayout;
|
||||
it->second.state = t.newLayout;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -187,7 +187,7 @@ void VulkanResourceManager::RecordTransitions(vector< pair<ResourceId, ImageRegi
|
||||
}
|
||||
|
||||
// if we've gone past where the new subresource range would sit
|
||||
if(it->second.range.aspectMask > t.subresourceRange.aspectMask)
|
||||
if(it->second.subresourceRange.aspectMask > t.subresourceRange.aspectMask)
|
||||
break;
|
||||
|
||||
// otherwise continue to try and find the subresource range
|
||||
@@ -213,8 +213,8 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
ResourceId id = srctrans[ti].first;
|
||||
const ImageRegionState &t = srctrans[ti].second;
|
||||
|
||||
uint32_t nummips = t.range.mipLevels;
|
||||
uint32_t numslices = t.range.arraySize;
|
||||
uint32_t nummips = t.subresourceRange.mipLevels;
|
||||
uint32_t numslices = t.subresourceRange.arraySize;
|
||||
|
||||
bool done = false;
|
||||
|
||||
@@ -230,24 +230,24 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
if(it->first < id) continue;
|
||||
if(it->first != id) break;
|
||||
|
||||
if(it->second.range.aspectMask & t.range.aspectMask)
|
||||
if(it->second.subresourceRange.aspectMask & t.subresourceRange.aspectMask)
|
||||
{
|
||||
// we've found a range that completely matches our region, doesn't matter if that's
|
||||
// a whole image and the transition is the whole image, or it's one subresource.
|
||||
// note that for images with only one array/mip slice (e.g. render targets) we'll never
|
||||
// really have to worry about the else{} branch
|
||||
if(it->second.range.baseMipLevel == t.range.baseMipLevel &&
|
||||
it->second.range.mipLevels == nummips &&
|
||||
it->second.range.baseArrayLayer == t.range.baseArrayLayer &&
|
||||
it->second.range.arraySize == numslices)
|
||||
if(it->second.subresourceRange.baseMipLevel == t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.mipLevels == nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer == t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.arraySize == numslices)
|
||||
{
|
||||
// verify
|
||||
//RDCASSERT(it->second.state == t.prevstate);
|
||||
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.prevstate;
|
||||
it->second.state = t.state;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
done = true;
|
||||
break;
|
||||
@@ -264,17 +264,17 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
// range could be sparse, but that's OK as we only break out of the loop once we go past the whole
|
||||
// aspect. Any subresources that don't match the range, after the split, will fail to meet any
|
||||
// of the handled cases, so we'll just continue processing.
|
||||
if(it->second.range.mipLevels == 1 &&
|
||||
it->second.range.arraySize == 1 &&
|
||||
it->second.range.baseMipLevel >= t.range.baseMipLevel &&
|
||||
it->second.range.baseMipLevel < t.range.baseMipLevel+nummips &&
|
||||
it->second.range.baseArrayLayer >= t.range.baseArrayLayer &&
|
||||
it->second.range.baseArrayLayer < t.range.baseArrayLayer+numslices)
|
||||
if(it->second.subresourceRange.mipLevels == 1 &&
|
||||
it->second.subresourceRange.arraySize == 1 &&
|
||||
it->second.subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.prevstate;
|
||||
it->second.state = t.state;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -285,14 +285,14 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
// case, so we know that the transition doesn't cover the whole range.
|
||||
// Also, if we've already done the split this case won't be hit and we'll either fall into
|
||||
// the case above, or we'll finish as we've covered the whole transition.
|
||||
else if(it->second.range.mipLevels > 1 || it->second.range.arraySize > 1)
|
||||
else if(it->second.subresourceRange.mipLevels > 1 || it->second.subresourceRange.arraySize > 1)
|
||||
{
|
||||
pair<ResourceId, ImageRegionState> existing = *it;
|
||||
|
||||
// remember where we were in the array, as after this iterators will be
|
||||
// invalidated.
|
||||
size_t offs = it - dsttrans.begin();
|
||||
size_t count = it->second.range.mipLevels * it->second.range.arraySize;
|
||||
size_t count = it->second.subresourceRange.mipLevels * it->second.subresourceRange.arraySize;
|
||||
|
||||
// only insert count-1 as we want count entries total - one per subresource
|
||||
dsttrans.insert(it, count-1, existing);
|
||||
@@ -303,12 +303,12 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
|
||||
for(size_t i=0; i < count; i++)
|
||||
{
|
||||
it->second.range.mipLevels = 1;
|
||||
it->second.range.arraySize = 1;
|
||||
it->second.subresourceRange.mipLevels = 1;
|
||||
it->second.subresourceRange.arraySize = 1;
|
||||
|
||||
// slice-major
|
||||
it->second.range.baseArrayLayer = uint32_t(i / existing.second.range.mipLevels);
|
||||
it->second.range.baseMipLevel = uint32_t(i % existing.second.range.mipLevels);
|
||||
it->second.subresourceRange.baseArrayLayer = uint32_t(i / existing.second.subresourceRange.mipLevels);
|
||||
it->second.subresourceRange.baseMipLevel = uint32_t(i % existing.second.subresourceRange.mipLevels);
|
||||
it++;
|
||||
}
|
||||
|
||||
@@ -317,15 +317,15 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
|
||||
// the loop will continue after this point and look at the next subresources
|
||||
// so we need to check to see if the first subresource lies in the range here
|
||||
if(it->second.range.baseMipLevel >= t.range.baseMipLevel &&
|
||||
it->second.range.baseMipLevel < t.range.baseMipLevel+nummips &&
|
||||
it->second.range.baseArrayLayer >= t.range.baseArrayLayer &&
|
||||
it->second.range.baseArrayLayer < t.range.baseArrayLayer+numslices)
|
||||
if(it->second.subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->second.subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->second.subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->second.subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->second.prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.prevstate = t.prevstate;
|
||||
it->second.state = t.state;
|
||||
if(it->second.oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->second.oldLayout = t.oldLayout;
|
||||
it->second.newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -338,7 +338,7 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
}
|
||||
|
||||
// if we've gone past where the new subresource range would sit
|
||||
if(it->second.range.aspectMask > t.range.aspectMask)
|
||||
if(it->second.subresourceRange.aspectMask > t.subresourceRange.aspectMask)
|
||||
break;
|
||||
|
||||
// otherwise continue to try and find the subresource range
|
||||
@@ -348,7 +348,7 @@ void VulkanResourceManager::MergeTransitions(vector< pair<ResourceId, ImageRegio
|
||||
|
||||
// we don't have an existing transition for this memory region, insert into place. it points to
|
||||
// where it should be inserted
|
||||
dsttrans.insert(it, std::make_pair(id, ImageRegionState(t.range, t.prevstate, t.state)));
|
||||
dsttrans.insert(it, std::make_pair(id, ImageRegionState(t.subresourceRange, t.oldLayout, t.newLayout)));
|
||||
}
|
||||
|
||||
TRDBG("Post-merge, there are %u transitions", (uint32_t)dsttrans.size());
|
||||
@@ -393,8 +393,8 @@ void VulkanResourceManager::SerialiseImageStates(map<ResourceId, ImageLayouts> &
|
||||
t.destQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
t.image = Unwrap(GetCurrentHandle<VkImage>(liveid));
|
||||
t.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
t.newLayout = state.state;
|
||||
t.subresourceRange = state.range;
|
||||
t.newLayout = state.newLayout;
|
||||
t.subresourceRange = state.subresourceRange;
|
||||
transitions.push_back(t);
|
||||
vec.push_back(std::make_pair(liveid, state));
|
||||
}
|
||||
@@ -406,7 +406,7 @@ void VulkanResourceManager::SerialiseImageStates(map<ResourceId, ImageLayouts> &
|
||||
ApplyTransitions(vec, states);
|
||||
|
||||
for(size_t i=0; i < vec.size(); i++)
|
||||
transitions[i].oldLayout = vec[i].second.prevstate;
|
||||
transitions[i].oldLayout = vec[i].second.oldLayout;
|
||||
|
||||
// erase any do-nothing transitions
|
||||
for(auto it=transitions.begin(); it != transitions.end();)
|
||||
@@ -437,8 +437,8 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t nummips = t.range.mipLevels;
|
||||
uint32_t numslices = t.range.arraySize;
|
||||
uint32_t nummips = t.subresourceRange.mipLevels;
|
||||
uint32_t numslices = t.subresourceRange.arraySize;
|
||||
if(nummips == VK_REMAINING_MIP_LEVELS) nummips = states[id].mipLevels;
|
||||
if(numslices == VK_REMAINING_ARRAY_LAYERS) numslices = states[id].arraySize;
|
||||
|
||||
@@ -446,13 +446,13 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
if(nummips == 0) nummips = 1;
|
||||
if(numslices == 0) numslices = 1;
|
||||
|
||||
if(t.prevstate == t.state) continue;
|
||||
if(t.oldLayout == t.newLayout) continue;
|
||||
|
||||
TRDBG("Transition of %s (%u->%u, %u->%u) from %s to %s",
|
||||
ToStr::Get(t.range.aspect).c_str(),
|
||||
t.range.baseMipLevel, t.range.mipLevels,
|
||||
t.range.baseArrayLayer, t.range.arraySize,
|
||||
ToStr::Get(t.prevstate).c_str(), ToStr::Get(t.state).c_str());
|
||||
ToStr::Get(t.subresourceRange.aspect).c_str(),
|
||||
t.subresourceRange.baseMipLevel, t.subresourceRange.mipLevels,
|
||||
t.subresourceRange.baseArrayLayer, t.subresourceRange.arraySize,
|
||||
ToStr::Get(t.oldLayout).c_str(), ToStr::Get(t.newLayout).c_str());
|
||||
|
||||
bool done = false;
|
||||
|
||||
@@ -462,34 +462,34 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
for(; it != stit->second.subresourceStates.end(); ++it)
|
||||
{
|
||||
TRDBG(".. state %s (%u->%u, %u->%u) from %s to %s",
|
||||
ToStr::Get(it->range.aspect).c_str(),
|
||||
ToStr::Get(it->subresourceRange.aspect).c_str(),
|
||||
it->range.baseMipLevel, it->range.mipLevels,
|
||||
it->range.baseArrayLayer, it->range.arraySize,
|
||||
ToStr::Get(it->prevstate).c_str(), ToStr::Get(it->state).c_str());
|
||||
ToStr::Get(it->oldLayout).c_str(), ToStr::Get(it->newLayout).c_str());
|
||||
|
||||
// image transitions are handled by initially inserting one subresource range for each aspect,
|
||||
// and whenever we need more fine-grained detail we split it immediately for one range for
|
||||
// each subresource in that aspect. Thereafter if a transition comes in that covers multiple
|
||||
// subresources, we transition all matching ranges.
|
||||
|
||||
if(it->range.aspectMask & t.range.aspectMask)
|
||||
if(it->subresourceRange.aspectMask & t.subresourceRange.aspectMask)
|
||||
{
|
||||
// we've found a range that completely matches our region, doesn't matter if that's
|
||||
// a whole image and the transition is the whole image, or it's one subresource.
|
||||
// note that for images with only one array/mip slice (e.g. render targets) we'll never
|
||||
// really have to worry about the else{} branch
|
||||
if(it->range.baseMipLevel == t.range.baseMipLevel &&
|
||||
it->range.mipLevels == nummips &&
|
||||
it->range.baseArrayLayer == t.range.baseArrayLayer &&
|
||||
it->range.arraySize == numslices)
|
||||
if(it->subresourceRange.baseMipLevel == t.subresourceRange.baseMipLevel &&
|
||||
it->subresourceRange.mipLevels == nummips &&
|
||||
it->subresourceRange.baseArrayLayer == t.subresourceRange.baseArrayLayer &&
|
||||
it->subresourceRange.arraySize == numslices)
|
||||
{
|
||||
/*
|
||||
RDCASSERT(t.prevstate == UNTRANSITIONED_IMG_STATE || it->state == UNTRANSITIONED_IMG_STATE || // renderdoc untracked/ignored
|
||||
it->state == t.prevstate || // valid transition
|
||||
t.prevstate == VK_IMAGE_LAYOUT_UNDEFINED); // can transition from UNDEFINED to any state
|
||||
*/
|
||||
t.prevstate = it->state;
|
||||
it->state = t.state;
|
||||
t.oldLayout = it->newLayout;
|
||||
it->newLayout = t.newLayout;
|
||||
|
||||
done = true;
|
||||
break;
|
||||
@@ -506,17 +506,17 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
// range could be sparse, but that's OK as we only break out of the loop once we go past the whole
|
||||
// aspect. Any subresources that don't match the range, after the split, will fail to meet any
|
||||
// of the handled cases, so we'll just continue processing.
|
||||
if(it->range.mipLevels == 1 &&
|
||||
it->range.arraySize == 1 &&
|
||||
it->range.baseMipLevel >= t.range.baseMipLevel &&
|
||||
it->range.baseMipLevel < t.range.baseMipLevel+nummips &&
|
||||
it->range.baseArrayLayer >= t.range.baseArrayLayer &&
|
||||
it->range.baseArrayLayer < t.range.baseArrayLayer+numslices)
|
||||
if(it->subresourceRange.mipLevels == 1 &&
|
||||
it->subresourceRange.arraySize == 1 &&
|
||||
it->subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->prevstate = t.prevstate;
|
||||
it->state = t.state;
|
||||
if(it->oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->oldLayout = t.oldLayout;
|
||||
it->newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -527,14 +527,14 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
// case, so we know that the transition doesn't cover the whole range.
|
||||
// Also, if we've already done the split this case won't be hit and we'll either fall into
|
||||
// the case above, or we'll finish as we've covered the whole transition.
|
||||
else if(it->range.mipLevels > 1 || it->range.arraySize > 1)
|
||||
else if(it->subresourceRange.mipLevels > 1 || it->subresourceRange.arraySize > 1)
|
||||
{
|
||||
ImageRegionState existing = *it;
|
||||
|
||||
// remember where we were in the array, as after this iterators will be
|
||||
// invalidated.
|
||||
size_t offs = it - stit->second.subresourceStates.begin();
|
||||
size_t count = it->range.mipLevels * it->range.arraySize;
|
||||
size_t count = it->subresourceRange.mipLevels * it->subresourceRange.arraySize;
|
||||
|
||||
// only insert count-1 as we want count entries total - one per subresource
|
||||
stit->second.subresourceStates.insert(it, count-1, existing);
|
||||
@@ -545,12 +545,12 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
|
||||
for(size_t i=0; i < count; i++)
|
||||
{
|
||||
it->range.mipLevels = 1;
|
||||
it->range.arraySize = 1;
|
||||
it->subresourceRange.mipLevels = 1;
|
||||
it->subresourceRange.arraySize = 1;
|
||||
|
||||
// slice-major
|
||||
it->range.baseArrayLayer = uint32_t(i / existing.range.mipLevels);
|
||||
it->range.baseMipLevel = uint32_t(i % existing.range.mipLevels);
|
||||
it->subresourceRange.baseArrayLayer = uint32_t(i / existing.subresourceRange.mipLevels);
|
||||
it->subresourceRange.baseMipLevel = uint32_t(i % existing.subresourceRange.mipLevels);
|
||||
it++;
|
||||
}
|
||||
|
||||
@@ -559,15 +559,15 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
|
||||
// the loop will continue after this point and look at the next subresources
|
||||
// so we need to check to see if the first subresource lies in the range here
|
||||
if(it->range.baseMipLevel >= t.range.baseMipLevel &&
|
||||
it->range.baseMipLevel < t.range.baseMipLevel+nummips &&
|
||||
it->range.baseArrayLayer >= t.range.baseArrayLayer &&
|
||||
it->range.baseArrayLayer < t.range.baseArrayLayer+numslices)
|
||||
if(it->subresourceRange.baseMipLevel >= t.subresourceRange.baseMipLevel &&
|
||||
it->subresourceRange.baseMipLevel < t.subresourceRange.baseMipLevel+nummips &&
|
||||
it->subresourceRange.baseArrayLayer >= t.subresourceRange.baseArrayLayer &&
|
||||
it->subresourceRange.baseArrayLayer < t.subresourceRange.baseArrayLayer+numslices)
|
||||
{
|
||||
// apply it (prevstate is from the start of all transitions, so only set once)
|
||||
if(it->prevstate == UNTRANSITIONED_IMG_STATE)
|
||||
it->prevstate = t.prevstate;
|
||||
it->state = t.state;
|
||||
if(it->oldLayout == UNTRANSITIONED_IMG_STATE)
|
||||
it->oldLayout = t.oldLayout;
|
||||
it->newLayout = t.newLayout;
|
||||
|
||||
// continue as there might be more, but we're done
|
||||
done = true;
|
||||
@@ -580,7 +580,7 @@ void VulkanResourceManager::ApplyTransitions(vector< pair<ResourceId, ImageRegio
|
||||
}
|
||||
|
||||
// if we've gone past where the new subresource range would sit
|
||||
if(it->range.aspectMask > t.range.aspectMask)
|
||||
if(it->subresourceRange.aspectMask > t.subresourceRange.aspectMask)
|
||||
break;
|
||||
|
||||
// otherwise continue to try and find the subresource range
|
||||
|
||||
@@ -830,7 +830,7 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
|
||||
VkImage liveIm = m_pDriver->GetResourceManager()->GetCurrentHandle<VkImage>(cfg.texid);
|
||||
|
||||
// VKTODOMED handle multiple subresources with different layouts etc
|
||||
VkImageLayout origLayout = layouts.subresourceStates[0].state;
|
||||
VkImageLayout origLayout = layouts.subresourceStates[0].newLayout;
|
||||
VkImageView liveImView = iminfo.view;
|
||||
|
||||
if(liveImView == VK_NULL_HANDLE)
|
||||
|
||||
@@ -536,18 +536,18 @@ VkResourceType IdentifyTypeByPtr(WrappedVkRes *ptr);
|
||||
struct ImageRegionState
|
||||
{
|
||||
ImageRegionState()
|
||||
: prevstate(UNTRANSITIONED_IMG_STATE), state(UNTRANSITIONED_IMG_STATE)
|
||||
: oldLayout(UNTRANSITIONED_IMG_STATE), newLayout(UNTRANSITIONED_IMG_STATE)
|
||||
{
|
||||
range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
range.baseArrayLayer = 0; range.arraySize = 0;
|
||||
range.baseMipLevel = 0; range.mipLevels = 0;
|
||||
subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
subresourceRange.baseArrayLayer = 0; subresourceRange.arraySize = 0;
|
||||
subresourceRange.baseMipLevel = 0; subresourceRange.mipLevels = 0;
|
||||
}
|
||||
ImageRegionState(VkImageSubresourceRange r, VkImageLayout pr, VkImageLayout st)
|
||||
: range(r), prevstate(pr), state(st) {}
|
||||
: subresourceRange(r), oldLayout(pr), newLayout(st) {}
|
||||
|
||||
VkImageSubresourceRange range;
|
||||
VkImageLayout prevstate;
|
||||
VkImageLayout state;
|
||||
VkImageSubresourceRange subresourceRange;
|
||||
VkImageLayout oldLayout;
|
||||
VkImageLayout newLayout;
|
||||
};
|
||||
|
||||
inline bool operator <(const VkDescriptorSet a, const VkDescriptorSet b)
|
||||
|
||||
Reference in new issue
Block a user