1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 10:54:16 +01:00

[dxvk] Merge clears with different views but identical subresources

This commit is contained in:
Philip Rebohle 2021-02-27 01:11:14 +01:00
parent 1c2edabbcb
commit 5f0f90f8d4
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 17 additions and 2 deletions

View File

@ -1856,7 +1856,7 @@ namespace dxvk {
VkImageAspectFlags clearAspects,
VkClearValue clearValue) {
for (auto& entry : m_deferredClears) {
if (entry.imageView == imageView) {
if (entry.imageView->checkSubresourceMatch(imageView)) {
entry.discardAspects &= ~clearAspects;
entry.clearAspects |= clearAspects;
@ -1882,7 +1882,7 @@ namespace dxvk {
const Rc<DxvkImageView>& imageView,
VkImageAspectFlags discardAspects) {
for (auto& entry : m_deferredClears) {
if (entry.imageView == imageView) {
if (entry.imageView->checkSubresourceMatch(imageView)) {
entry.discardAspects |= discardAspects;
entry.clearAspects &= ~discardAspects;
return;

View File

@ -469,6 +469,21 @@ namespace dxvk {
return result;
}
/**
* \brief Checks whether this view matches another
*
* \param [in] view The other view to check
* \returns \c true if the two views have the same subresources
*/
bool checkSubresourceMatch(const Rc<DxvkImageView>& view) const {
if (this == view.ptr())
return true;
return this->image() == view->image()
&& this->subresources() == view->subresources()
&& this->info().type == view->info().type;
}
/**
* \brief Checks whether this view overlaps with another one
*