From 635d96a5bacaefefe65f38b2fc30b114a3de3c5c Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 5 Mar 2025 12:33:59 +0100 Subject: [PATCH] [dxvk] Also try to use render pass resolves on desktop drivers Elides redundant back-to-back resolves in some games, and reduces some barrier spam when the app resolves multiple images. --- src/dxvk/dxvk_context.cpp | 12 ++++++------ src/dxvk/dxvk_device.cpp | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index ea0bb7d47..ffcdda82f 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2458,9 +2458,6 @@ namespace dxvk { void DxvkContext::flushResolves() { - if (!m_device->perfHints().preferRenderPassOps) - return; - for (size_t i = 0; i < m_state.om.framebufferInfo.numAttachments(); i++) { auto& resolve = m_deferredResolves.at(i); @@ -5659,10 +5656,13 @@ namespace dxvk { // On drivers that don't natively support secondary command buffers, only // use them to enable MSAA resolve attachments. Also ignore color-only // render passes here since we almost certainly need the output anyway. - bool useSecondaryCmdBuffer = m_device->perfHints().preferRenderPassOps; + bool useSecondaryCmdBuffer = !m_device->perfHints().preferPrimaryCmdBufs + && renderingInheritance.rasterizationSamples > VK_SAMPLE_COUNT_1_BIT; - if (useSecondaryCmdBuffer && (m_device->perfHints().preferPrimaryCmdBufs || !depthStencilAspects)) - useSecondaryCmdBuffer = renderingInheritance.rasterizationSamples > VK_SAMPLE_COUNT_1_BIT; + if (m_device->perfHints().preferRenderPassOps) { + useSecondaryCmdBuffer = renderingInheritance.rasterizationSamples > VK_SAMPLE_COUNT_1_BIT + || (!m_device->perfHints().preferPrimaryCmdBufs && depthStencilAspects); + } if (useSecondaryCmdBuffer) { // Begin secondary command buffer on tiling GPUs so that subsequent diff --git a/src/dxvk/dxvk_device.cpp b/src/dxvk/dxvk_device.cpp index e0f04e74d..7b6aafb3a 100644 --- a/src/dxvk/dxvk_device.cpp +++ b/src/dxvk/dxvk_device.cpp @@ -451,8 +451,7 @@ namespace dxvk { // Be less aggressive on secondary command buffer usage on // drivers that do not natively support them - hints.preferPrimaryCmdBufs = !hints.preferRenderPassOps - || m_adapter->matchesDriver(VK_DRIVER_ID_MESA_HONEYKRISP); + hints.preferPrimaryCmdBufs = m_adapter->matchesDriver(VK_DRIVER_ID_MESA_HONEYKRISP); return hints; }