From f16ba4794ba458f31cdb4109690cd18bfab20604 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 17 Jul 2019 20:35:00 +0200 Subject: [PATCH] [d3d11] Use unlikely() for some query code This is a somewhat hot path in some games, so why not. --- src/d3d11/d3d11_context.cpp | 4 ++-- src/d3d11/d3d11_query.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 9c4d677b..a534f9f9 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -247,7 +247,7 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::Begin(ID3D11Asynchronous *pAsync) { D3D10DeviceLock lock = LockContext(); - if (!pAsync) + if (unlikely(!pAsync)) return; Com query(static_cast(pAsync)); @@ -262,7 +262,7 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::End(ID3D11Asynchronous *pAsync) { D3D10DeviceLock lock = LockContext(); - if (!pAsync) + if (unlikely(!pAsync)) return; Com query(static_cast(pAsync)); diff --git a/src/d3d11/d3d11_query.cpp b/src/d3d11/d3d11_query.cpp index 76721721..c9ec1613 100644 --- a/src/d3d11/d3d11_query.cpp +++ b/src/d3d11/d3d11_query.cpp @@ -214,7 +214,7 @@ namespace dxvk { ctx->endQuery(m_query[0]); } - if (m_predicate.defined()) + if (unlikely(m_predicate.defined())) ctx->writePredicate(m_predicate, m_query[0]); m_state = D3D11_VK_QUERY_ENDED;