mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-22 16:54:27 +01:00
[d3d11] Remove explicit swapchain synchronization
This commit is contained in:
parent
42adc4ac11
commit
785649f3b8
@ -77,8 +77,7 @@ namespace dxvk {
|
|||||||
if (this_thread::isInModuleDetachment())
|
if (this_thread::isInModuleDetachment())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_device->waitForSubmission(&m_presentStatus);
|
m_presenter->destroyResources();
|
||||||
m_device->waitForIdle();
|
|
||||||
|
|
||||||
DestroyFrameLatencyEvent();
|
DestroyFrameLatencyEvent();
|
||||||
}
|
}
|
||||||
@ -259,15 +258,7 @@ namespace dxvk {
|
|||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// If the current present status is NOT_READY, we have a present
|
VkResult status = m_presenter->checkSwapChainStatus();
|
||||||
// in flight, which means that we can most likely present again.
|
|
||||||
// This avoids an expensive sync point.
|
|
||||||
VkResult status = m_presentStatus.result.load();
|
|
||||||
|
|
||||||
if (status == VK_NOT_READY)
|
|
||||||
return S_OK;
|
|
||||||
|
|
||||||
status = m_presenter->checkSwapChainStatus();
|
|
||||||
return status == VK_SUCCESS ? S_OK : DXGI_STATUS_OCCLUDED;
|
return status == VK_SUCCESS ? S_OK : DXGI_STATUS_OCCLUDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,8 +367,6 @@ namespace dxvk {
|
|||||||
immediateContext->EndFrame();
|
immediateContext->EndFrame();
|
||||||
immediateContext->Flush();
|
immediateContext->Flush();
|
||||||
|
|
||||||
SynchronizePresent();
|
|
||||||
|
|
||||||
m_presenter->setSyncInterval(SyncInterval);
|
m_presenter->setSyncInterval(SyncInterval);
|
||||||
|
|
||||||
// Presentation semaphores and WSI swap chain image
|
// Presentation semaphores and WSI swap chain image
|
||||||
@ -396,8 +385,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Present from CS thread so that we don't
|
// Present from CS thread so that we don't
|
||||||
// have to synchronize with it first.
|
// have to synchronize with it first.
|
||||||
m_presentStatus.result = VK_NOT_READY;
|
|
||||||
|
|
||||||
DxvkImageViewKey viewInfo = { };
|
DxvkImageViewKey viewInfo = { };
|
||||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
@ -409,7 +396,6 @@ namespace dxvk {
|
|||||||
viewInfo.layerCount = 1u;
|
viewInfo.layerCount = 1u;
|
||||||
|
|
||||||
immediateContext->EmitCs([
|
immediateContext->EmitCs([
|
||||||
cPresentStatus = &m_presentStatus,
|
|
||||||
cDevice = m_device,
|
cDevice = m_device,
|
||||||
cBlitter = m_blitter,
|
cBlitter = m_blitter,
|
||||||
cBackBuffer = backBuffer->createView(viewInfo),
|
cBackBuffer = backBuffer->createView(viewInfo),
|
||||||
@ -439,8 +425,7 @@ namespace dxvk {
|
|||||||
ctx->synchronizeWsi(cSync);
|
ctx->synchronizeWsi(cSync);
|
||||||
ctx->flushCommandList(nullptr);
|
ctx->flushCommandList(nullptr);
|
||||||
|
|
||||||
cDevice->presentImage(cPresenter,
|
cDevice->presentImage(cPresenter, cFrameId, nullptr);
|
||||||
cFrameId, cPresentStatus);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_backBuffers.size() > 1u)
|
if (m_backBuffers.size() > 1u)
|
||||||
@ -470,11 +455,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11SwapChain::SynchronizePresent() {
|
|
||||||
m_device->waitForSubmission(&m_presentStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11SwapChain::CreateFrameLatencyEvent() {
|
void D3D11SwapChain::CreateFrameLatencyEvent() {
|
||||||
m_frameLatencySignal = new sync::CallbackFence(m_frameId);
|
m_frameLatencySignal = new sync::CallbackFence(m_frameId);
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ namespace dxvk {
|
|||||||
Rc<DxvkSwapchainBlitter> m_blitter;
|
Rc<DxvkSwapchainBlitter> m_blitter;
|
||||||
|
|
||||||
small_vector<Com<D3D11Texture2D, false>, 4> m_backBuffers;
|
small_vector<Com<D3D11Texture2D, false>, 4> m_backBuffers;
|
||||||
DxvkSubmitStatus m_presentStatus;
|
|
||||||
|
|
||||||
uint64_t m_frameId = DXGI_MAX_SWAP_CHAIN_BUFFERS;
|
uint64_t m_frameId = DXGI_MAX_SWAP_CHAIN_BUFFERS;
|
||||||
uint32_t m_frameLatency = DefaultFrameLatency;
|
uint32_t m_frameLatency = DefaultFrameLatency;
|
||||||
@ -130,8 +129,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
void RotateBackBuffers(D3D11ImmediateContext* ctx);
|
void RotateBackBuffers(D3D11ImmediateContext* ctx);
|
||||||
|
|
||||||
void SynchronizePresent();
|
|
||||||
|
|
||||||
void CreateFrameLatencyEvent();
|
void CreateFrameLatencyEvent();
|
||||||
|
|
||||||
void CreatePresenter();
|
void CreatePresenter();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user