From 2dfdc5ac3bc7d37f96ca1e2a9f58bcc331dd8be2 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 16 Feb 2022 19:44:40 +0100 Subject: [PATCH] [d3d11] Enable stall tracking for timestamp queries Because games are dumb and don't understand that the GPU doesn't work synchronously with the render thread. --- src/d3d11/d3d11_context_imm.cpp | 10 ++++++---- src/d3d11/d3d11_query.h | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 51822722..9db13bba 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -140,11 +140,13 @@ namespace dxvk { cQuery->End(ctx); }); - if (unlikely(query->IsEvent())) { + if (unlikely(query->TrackStalls())) { query->NotifyEnd(); - query->IsStalling() - ? Flush() - : FlushImplicit(TRUE); + + if (query->IsStalling()) + Flush(); + else if (query->IsEvent()) + FlushImplicit(TRUE); } } diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index 06ac4a1a..a1853cfc 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -62,6 +62,12 @@ namespace dxvk { return m_desc.Query == D3D11_QUERY_EVENT; } + bool TrackStalls() const { + return m_desc.Query == D3D11_QUERY_EVENT + || m_desc.Query == D3D11_QUERY_TIMESTAMP + || m_desc.Query == D3D11_QUERY_TIMESTAMP_DISJOINT; + } + bool IsStalling() const { return m_stallFlag; }