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

[dxvk] Check view format as well when deferring clears

Otherwise, we may accidentally clear to an incorrect value.
Fixes #2100.
This commit is contained in:
Philip Rebohle 2021-06-14 16:40:34 +02:00
parent 30a1a29aa6
commit de05728c8c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 6 additions and 5 deletions

View File

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

View File

@ -50,7 +50,7 @@ namespace dxvk {
int32_t DxvkFramebuffer::findAttachment(const Rc<DxvkImageView>& view) const {
for (uint32_t i = 0; i < m_attachmentCount; i++) {
if (getAttachment(i).view->checkSubresourceMatch(view))
if (getAttachment(i).view->matchesView(view))
return int32_t(i);
}

View File

@ -485,13 +485,14 @@ namespace dxvk {
* \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 {
bool matchesView(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;
&& this->info().type == view->info().type
&& this->info().format == view->info().format;
}
/**