diff --git a/src/d3d9/d3d9_subresource.h b/src/d3d9/d3d9_subresource.h index a76a0ac6..2d2c981b 100644 --- a/src/d3d9/d3d9_subresource.h +++ b/src/d3d9/d3d9_subresource.h @@ -111,6 +111,14 @@ namespace dxvk { return m_container; } + void Swap(D3D9Subresource* Other) { + // Only used for swap chain back buffers that don't + // have a container and all have identical properties + std::swap(m_texture, Other->m_texture); + std::swap(m_sampleView, Other->m_sampleView); + std::swap(m_renderTargetView, Other->m_renderTargetView); + } + protected: IDirect3DBaseTexture9* m_container; diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 757df1e4..15822b40 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -739,6 +739,13 @@ namespace dxvk { SubmitPresent(sync, i); } + + // Rotate swap chain buffers so that the back + // buffer at index 0 becomes the front buffer. + for (uint32_t i = 1; i < m_backBuffers.size(); i++) + m_backBuffers[i]->Swap(m_backBuffers[i - 1].ptr()); + + m_parent->m_flags.set(D3D9DeviceFlag::DirtyFramebuffer); }