mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[d3d11] Update HUD on CS thread
Otherwise, we may end up reading some bollocks since the CS thread might not have finished processing the entire frame yet.
This commit is contained in:
parent
2689204d74
commit
ae7189f9a4
@ -239,9 +239,6 @@ namespace dxvk {
|
||||
uint64_t frameId = ++m_frameId;
|
||||
m_frameLatencySignal->wait(frameId - GetActualFrameLatency());
|
||||
|
||||
if (m_hud != nullptr)
|
||||
m_hud->update();
|
||||
|
||||
for (uint32_t i = 0; i < SyncInterval || i < 1; i++) {
|
||||
SynchronizePresent();
|
||||
|
||||
@ -340,7 +337,7 @@ namespace dxvk {
|
||||
if (i + 1 >= SyncInterval)
|
||||
m_context->signal(m_frameLatencySignal, frameId);
|
||||
|
||||
SubmitPresent(immediateContext, sync);
|
||||
SubmitPresent(immediateContext, sync, i);
|
||||
}
|
||||
|
||||
SignalFrameLatencyEvent();
|
||||
@ -349,18 +346,24 @@ namespace dxvk {
|
||||
|
||||
void D3D11SwapChain::SubmitPresent(
|
||||
D3D11ImmediateContext* pContext,
|
||||
const vk::PresenterSync& Sync) {
|
||||
const vk::PresenterSync& Sync,
|
||||
uint32_t FrameId) {
|
||||
// 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,
|
||||
cSync = Sync,
|
||||
cHud = m_hud,
|
||||
cCommandList = m_context->endRecording()
|
||||
] (DxvkContext* ctx) {
|
||||
m_device->submitCommandList(cCommandList,
|
||||
cSync.acquire, cSync.present);
|
||||
|
||||
if (cHud != nullptr && !cFrameId)
|
||||
cHud->update();
|
||||
|
||||
m_device->presentImage(m_presenter,
|
||||
cSync.present, &m_presentStatus);
|
||||
});
|
||||
|
@ -139,7 +139,8 @@ namespace dxvk {
|
||||
|
||||
void SubmitPresent(
|
||||
D3D11ImmediateContext* pContext,
|
||||
const vk::PresenterSync& Sync);
|
||||
const vk::PresenterSync& Sync,
|
||||
uint32_t FrameId);
|
||||
|
||||
void SynchronizePresent();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user