mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 07:24:15 +01:00
[d3d11] Use new presenter signal mechanism for frame latency event
This commit is contained in:
parent
08363edb05
commit
e99bc591df
@ -336,9 +336,6 @@ namespace dxvk {
|
||||
immediateContext->EndFrame();
|
||||
immediateContext->Flush();
|
||||
|
||||
// Bump our frame id.
|
||||
++m_frameId;
|
||||
|
||||
for (uint32_t i = 0; i < SyncInterval || i < 1; i++) {
|
||||
SynchronizePresent();
|
||||
|
||||
@ -380,9 +377,6 @@ namespace dxvk {
|
||||
if (m_hud != nullptr)
|
||||
m_hud->render(m_context, info.format, info.imageExtent);
|
||||
|
||||
if (i + 1 >= SyncInterval)
|
||||
m_context->signal(m_frameLatencySignal, m_frameId);
|
||||
|
||||
SubmitPresent(immediateContext, sync, i);
|
||||
}
|
||||
|
||||
@ -394,27 +388,35 @@ namespace dxvk {
|
||||
void D3D11SwapChain::SubmitPresent(
|
||||
D3D11ImmediateContext* pContext,
|
||||
const PresenterSync& Sync,
|
||||
uint32_t FrameId) {
|
||||
uint32_t Repeat) {
|
||||
auto lock = pContext->LockContext();
|
||||
|
||||
// Bump frame ID as necessary
|
||||
if (!Repeat)
|
||||
m_frameId += 1;
|
||||
|
||||
// Present from CS thread so that we don't
|
||||
// have to synchronize with it first.
|
||||
m_presentStatus.result = VK_NOT_READY;
|
||||
|
||||
pContext->EmitCs([this,
|
||||
cFrameId = FrameId,
|
||||
cRepeat = Repeat,
|
||||
cSync = Sync,
|
||||
cHud = m_hud,
|
||||
cPresentMode = m_presenter->info().presentMode,
|
||||
cFrameId = m_frameId,
|
||||
cCommandList = m_context->endRecording()
|
||||
] (DxvkContext* ctx) {
|
||||
cCommandList->setWsiSemaphores(cSync);
|
||||
m_device->submitCommandList(cCommandList, nullptr);
|
||||
|
||||
if (cHud != nullptr && !cFrameId)
|
||||
if (cHud != nullptr && !cRepeat)
|
||||
cHud->update();
|
||||
|
||||
m_device->presentImage(m_presenter, cPresentMode, 0, &m_presentStatus);
|
||||
uint64_t frameId = cRepeat ? 0 : cFrameId;
|
||||
|
||||
m_device->presentImage(m_presenter,
|
||||
cPresentMode, frameId, &m_presentStatus);
|
||||
});
|
||||
|
||||
pContext->FlushCsChunk();
|
||||
@ -479,7 +481,7 @@ namespace dxvk {
|
||||
presenterDesc.numFormats = PickFormats(m_desc.Format, presenterDesc.formats);
|
||||
presenterDesc.fullScreenExclusive = PickFullscreenMode();
|
||||
|
||||
m_presenter = new Presenter(m_device, nullptr, presenterDesc);
|
||||
m_presenter = new Presenter(m_device, m_frameLatencySignal, presenterDesc);
|
||||
m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ namespace dxvk {
|
||||
void SubmitPresent(
|
||||
D3D11ImmediateContext* pContext,
|
||||
const PresenterSync& Sync,
|
||||
uint32_t FrameId);
|
||||
uint32_t Repeat);
|
||||
|
||||
void SynchronizePresent();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user