mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Fix deferred clear logic for overlapping image views
If we clear the same image subresources twice with different views and then start rendering to one view, we may end up clearing to the wrong clear value.
This commit is contained in:
parent
96e1079526
commit
5e55ced8b2
@ -1868,7 +1868,8 @@ namespace dxvk {
|
||||
entry.clearValue.depthStencil.stencil = clearValue.depthStencil.stencil;
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (entry.imageView->checkSubresourceOverlap(imageView))
|
||||
this->flushClears(false);
|
||||
}
|
||||
|
||||
m_deferredClears.push_back({ imageView, 0, clearAspects, clearValue });
|
||||
@ -1883,7 +1884,8 @@ namespace dxvk {
|
||||
entry.discardAspects |= discardAspects;
|
||||
entry.clearAspects &= ~discardAspects;
|
||||
return;
|
||||
}
|
||||
} else if (entry.imageView->checkSubresourceOverlap(imageView))
|
||||
this->flushClears(false);
|
||||
}
|
||||
|
||||
m_deferredClears.push_back({ imageView, discardAspects });
|
||||
|
@ -469,6 +469,23 @@ namespace dxvk {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Checks whether this view overlaps with another one
|
||||
*
|
||||
* Two views overlap if they were created for the same
|
||||
* image and have at least one subresource in common.
|
||||
* \param [in] view The other view to check
|
||||
* \returns \c true if the two views overlap
|
||||
*/
|
||||
bool checkSubresourceOverlap(const Rc<DxvkImageView>& view) const {
|
||||
if (likely(m_image != view->m_image))
|
||||
return false;
|
||||
|
||||
return vk::checkSubresourceRangeOverlap(
|
||||
this->imageSubresources(),
|
||||
view->imageSubresources());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Rc<vk::DeviceFn> m_vkd;
|
||||
|
Loading…
Reference in New Issue
Block a user