Skip to content

Commit a7f0f3b

Browse files
committed
[d3d9] Don't unbind buffers on Ex device
We don't reset the state on Ex devices either.
1 parent 8eb3eeb commit a7f0f3b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/d3d9/d3d9_device.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ namespace dxvk {
493493
m_implicitSwapchain->DestroyBackBuffers();
494494
m_autoDepthStencil = nullptr;
495495

496+
// Unbind all buffers that were still bound to the backend to avoid leaks.
497+
EmitCs([](DxvkContext* ctx) {
498+
ctx->bindIndexBuffer(DxvkBufferSlice(), VK_INDEX_TYPE_UINT32);
499+
for (uint32_t i = 0; i < caps::MaxStreams; i++) {
500+
ctx->bindVertexBuffer(i, DxvkBufferSlice(), 0);
501+
}
502+
});
503+
496504
// Tests show that regular D3D9 ends the scene in Reset
497505
// while D3D9Ex doesn't.
498506
// Observed in Empires: Dawn of the Modern World (D3D8)
@@ -533,14 +541,6 @@ namespace dxvk {
533541
return hr;
534542
}
535543

536-
// Unbind all buffers that were still bound to the backend to avoid leaks.
537-
EmitCs([](DxvkContext* ctx) {
538-
ctx->bindIndexBuffer(DxvkBufferSlice(), VK_INDEX_TYPE_UINT32);
539-
for (uint32_t i = 0; i < caps::MaxStreams; i++) {
540-
ctx->bindVertexBuffer(i, DxvkBufferSlice(), 0);
541-
}
542-
});
543-
544544
Flush();
545545
SynchronizeCsThread(DxvkCsThread::SynchronizeAll);
546546

0 commit comments

Comments
 (0)