From c547039bef814b53bbe19e6f2f8e43cd828b72c6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 27 Nov 2020 12:16:37 +0100 Subject: [PATCH] [dxvk] Decide memory priority based on access flags rather than usage Buffers used as shader resources are storage buffers as well, and should not take priority over other read-only resources. --- src/dxvk/dxvk_buffer.cpp | 7 +++---- src/dxvk/dxvk_image.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/dxvk/dxvk_buffer.cpp b/src/dxvk/dxvk_buffer.cpp index 9d07e06cf..b7e3c4472 100644 --- a/src/dxvk/dxvk_buffer.cpp +++ b/src/dxvk/dxvk_buffer.cpp @@ -99,10 +99,9 @@ namespace dxvk { vkd->device(), &memReqInfo, &memReq); // Use high memory priority for GPU-writable resources - bool isGpuWritable = (m_info.usage & ( - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | - VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) != 0; - + bool isGpuWritable = (m_info.access & ( + VK_ACCESS_SHADER_WRITE_BIT | + VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT)) != 0; float priority = isGpuWritable ? 1.0f : 0.5f; // Ask driver whether we should be using a dedicated allocation diff --git a/src/dxvk/dxvk_image.cpp b/src/dxvk/dxvk_image.cpp index 353320886..142b3ac14 100644 --- a/src/dxvk/dxvk_image.cpp +++ b/src/dxvk/dxvk_image.cpp @@ -90,10 +90,12 @@ namespace dxvk { } // Use high memory priority for GPU-writable resources - bool isGpuWritable = (m_info.usage & ( - VK_IMAGE_USAGE_STORAGE_BIT | - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | - VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) != 0; + bool isGpuWritable = (m_info.access & ( + VK_ACCESS_SHADER_WRITE_BIT | + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT)) != 0; float priority = isGpuWritable ? 1.0f : 0.5f;