From 6ecb74d2c005ec74037fb7ecf11ffe68cf4b8f82 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 21 Sep 2019 05:13:05 +0200 Subject: [PATCH] [dxvk] Check if xfb buffers have actually changed on binding We should avoid redundant render pass spilling at all costs. This affects all games using deferred contexts for rendering due to their implicit use of ClearState and RestoreState. --- src/dxvk/dxvk_context.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index e431830bf..8e16b40c3 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -253,12 +253,15 @@ namespace dxvk { uint32_t binding, const DxvkBufferSlice& buffer, const DxvkBufferSlice& counter) { - this->spillRenderPass(); + if (!m_state.xfb.buffers [binding].matches(buffer) + || !m_state.xfb.counters[binding].matches(counter)) { + this->spillRenderPass(); - m_state.xfb.buffers [binding] = buffer; - m_state.xfb.counters[binding] = counter; - - m_flags.set(DxvkContextFlag::GpDirtyXfbBuffers); + m_state.xfb.buffers [binding] = buffer; + m_state.xfb.counters[binding] = counter; + + m_flags.set(DxvkContextFlag::GpDirtyXfbBuffers); + } }