From 0671007437a4d926458e6b244d7d9413d1b0d642 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 2 Nov 2019 12:40:21 +0100 Subject: [PATCH] [d3d11] Only execute Begin for scoped queries --- src/d3d11/d3d11_context.cpp | 3 +++ src/d3d11/d3d11_query.h | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index e38bb7112..d9d81b945 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -251,6 +251,9 @@ namespace dxvk { Com query(static_cast(pAsync)); + if (unlikely(!query->IsScoped())) + return; + EmitCs([cQuery = std::move(query)] (DxvkContext* ctx) { cQuery->Begin(ctx); diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index 1c1f7b812..369d40168 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -38,7 +38,7 @@ namespace dxvk { void STDMETHODCALLTYPE GetDesc(D3D11_QUERY_DESC* pDesc) final; void STDMETHODCALLTYPE GetDesc1(D3D11_QUERY_DESC1* pDesc) final; - + void Begin(DxvkContext* ctx); void End(DxvkContext* ctx); @@ -49,6 +49,11 @@ namespace dxvk { DxvkBufferSlice GetPredicate(DxvkContext* ctx); + bool IsScoped() const { + return m_desc.Query != D3D11_QUERY_EVENT + && m_desc.Query != D3D11_QUERY_TIMESTAMP; + } + bool IsEvent() const { return m_desc.Query == D3D11_QUERY_EVENT; }