Only ignore transitions from undefined current state for partial updates

* If the current state of a temporary ImageState is unknown in a renderpass
  transition mid-command buffer that means it's a subresource which isn't
  touched and we want to skip barriering it. We *don't* want to barrier from
  UNDEFINED and discard.
* However if this is a real ImageState which hasn't been initialised, we do want
  to do that. So only opt-in to the skipping behaviour in the case we know this
  isn't a 'real' ImageState but a temporary tracker.
This commit is contained in:
baldurk
2021-04-28 16:29:41 +01:00
parent 57c22874e3
commit b70d157a35
3 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -1271,8 +1271,9 @@ void ImageState::Transition(const ImageState &dstState, VkAccessFlags srcAccessM
{
ImageSubresourceState srcSub;
// ignore transitions of subresources that were untouched
if(it->state() == ImageSubresourceState())
// ignore transitions of subresources that were untouched if this isn't the *canonical* image
// state, but just an overlay tracking changes within a command buffer
if(it->state() == ImageSubresourceState() && m_Overlay)
continue;
if(!it->state().Update(dstSub, srcSub, info.GetFrameRefCompFunc()))
+2
View File
@@ -1700,6 +1700,7 @@ struct ImageState
rdcarray<VkImageMemoryBarrier> oldQueueFamilyTransfers;
rdcarray<VkImageMemoryBarrier> newQueueFamilyTransfers;
bool isMemoryBound = false;
bool m_Overlay = false;
ResourceId boundMemory = ResourceId();
VkDeviceSize boundMemoryOffset = 0ull;
VkDeviceSize boundMemorySize = 0ull;
@@ -1712,6 +1713,7 @@ struct ImageState
: wrappedHandle(wrappedHandle), subresourceStates(imageInfo, refType), maxRefType(refType)
{
}
void SetOverlay() { m_Overlay = true; }
ImageState InitialState() const;
void InitialState(ImageState &result) const;
ImageState CommandBufferInitialState() const;
@@ -1164,6 +1164,7 @@ bool WrappedVulkan::Serialise_vkEndCommandBuffer(SerialiserType &ser, VkCommandB
{
ResourceId id = it->first;
ImageState &endState = it->second;
endState.SetOverlay();
LockedConstImageStateRef current = FindConstImageState(id);
if(!current)
{