mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Use new signals as frame synchronization events
This commit is contained in:
parent
f0acc40e50
commit
15072afa1f
@ -1909,7 +1909,7 @@ namespace dxvk {
|
|||||||
m_wineFactory (this, &m_d3d11Device),
|
m_wineFactory (this, &m_d3d11Device),
|
||||||
m_frameLatencyCap(m_d3d11Device.GetOptions()->maxFrameLatency) {
|
m_frameLatencyCap(m_d3d11Device.GetOptions()->maxFrameLatency) {
|
||||||
for (uint32_t i = 0; i < m_frameEvents.size(); i++)
|
for (uint32_t i = 0; i < m_frameEvents.size(); i++)
|
||||||
m_frameEvents[i] = new DxvkEvent();
|
m_frameEvents[i] = new sync::Signal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2102,7 +2102,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rc<DxvkEvent> STDMETHODCALLTYPE D3D11DXGIDevice::GetFrameSyncEvent(UINT BufferCount) {
|
Rc<sync::Signal> STDMETHODCALLTYPE D3D11DXGIDevice::GetFrameSyncEvent(UINT BufferCount) {
|
||||||
uint32_t frameLatency = m_frameLatency;
|
uint32_t frameLatency = m_frameLatency;
|
||||||
|
|
||||||
if (BufferCount != 0
|
if (BufferCount != 0
|
||||||
|
@ -530,7 +530,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void STDMETHODCALLTYPE Trim() final;
|
void STDMETHODCALLTYPE Trim() final;
|
||||||
|
|
||||||
Rc<DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent(
|
Rc<sync::Signal> STDMETHODCALLTYPE GetFrameSyncEvent(
|
||||||
UINT BufferCount);
|
UINT BufferCount);
|
||||||
|
|
||||||
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice();
|
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice();
|
||||||
@ -552,7 +552,7 @@ namespace dxvk {
|
|||||||
uint32_t m_frameLatency = DefaultFrameLatency;
|
uint32_t m_frameLatency = DefaultFrameLatency;
|
||||||
uint32_t m_frameId = 0;
|
uint32_t m_frameId = 0;
|
||||||
|
|
||||||
std::array<Rc<DxvkEvent>, 16> m_frameEvents;
|
std::array<Rc<sync::Signal>, 16> m_frameEvents;
|
||||||
|
|
||||||
Rc<DxvkDevice> CreateDevice(D3D_FEATURE_LEVEL FeatureLevel);
|
Rc<DxvkDevice> CreateDevice(D3D_FEATURE_LEVEL FeatureLevel);
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void D3D11SwapChain::PresentImage(UINT SyncInterval) {
|
void D3D11SwapChain::PresentImage(UINT SyncInterval) {
|
||||||
// Wait for the sync event so that we respect the maximum frame latency
|
// Wait for the sync event so that we respect the maximum frame latency
|
||||||
Rc<DxvkEvent> syncEvent = m_dxgiDevice->GetFrameSyncEvent(m_desc.BufferCount);
|
auto syncEvent = m_dxgiDevice->GetFrameSyncEvent(m_desc.BufferCount);
|
||||||
syncEvent->wait();
|
syncEvent->wait();
|
||||||
|
|
||||||
if (m_hud != nullptr)
|
if (m_hud != nullptr)
|
||||||
@ -298,12 +298,8 @@ namespace dxvk {
|
|||||||
if (m_hud != nullptr)
|
if (m_hud != nullptr)
|
||||||
m_hud->render(m_context, info.imageExtent);
|
m_hud->render(m_context, info.imageExtent);
|
||||||
|
|
||||||
if (i + 1 >= SyncInterval) {
|
if (i + 1 >= SyncInterval)
|
||||||
DxvkEventRevision eventRev;
|
m_context->queueSignal(syncEvent);
|
||||||
eventRev.event = syncEvent;
|
|
||||||
eventRev.revision = syncEvent->reset();
|
|
||||||
m_context->signalEvent(eventRev);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_device->submitCommandList(
|
m_device->submitCommandList(
|
||||||
m_context->endRecording(),
|
m_context->endRecording(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user