diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 054560088..ca2c9a316 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -4746,6 +4746,15 @@ namespace dxvk { } + template + void D3D11CommonContext::ResetDirtyTracking() { + // Must only be called when all bindings are guaranteed to get applied + // to the DXVK context before the next draw or dispatch command. + m_state.lazy.bindingsDirty.reset(); + m_state.lazy.shadersDirty = 0u; + } + + template void D3D11CommonContext::ResetStagingBuffer() { m_staging.reset(); @@ -4880,6 +4889,8 @@ namespace dxvk { for (uint32_t i = 0; i < m_state.so.targets.size(); i++) BindXfbBuffer(i, m_state.so.targets[i].buffer.ptr(), ~0u); + ResetDirtyTracking(); + for (uint32_t i = 0; i < uint32_t(DxbcProgramType::Count); i++) { auto stage = DxbcProgramType(i); diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 0f95ed414..0577c314d 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -992,6 +992,8 @@ namespace dxvk { void ResetContextState(); + void ResetDirtyTracking(); + void ResetStagingBuffer(); template diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index e22201afa..44d9d7ce3 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -754,7 +754,11 @@ namespace dxvk { if (!pState) return; - // Reset all state affected by the current context state + // Clear dirty tracking here since all context state will be + // re-applied anyway when the context state is swapped in again. + ResetDirtyTracking(); + + // Reset all state affected by the current context state. ResetCommandListState(); Com oldState = std::move(m_stateObject);