From 3a3d7fb3782948c3373f3448e5ff42d837a119ae Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 24 Mar 2019 01:47:36 +0100 Subject: [PATCH] [d3d11] Properly implement SetPredication --- src/d3d11/d3d11_context.cpp | 23 ++++++++++++++++------- src/d3d11/d3d11_query.h | 4 ++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 349757ec9..6867895ea 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -273,15 +273,24 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::SetPredication( ID3D11Predicate* pPredicate, BOOL PredicateValue) { - static bool s_errorShown = false; - - if (pPredicate && !std::exchange(s_errorShown, true)) - Logger::err("D3D11DeviceContext::SetPredication: Stub"); - D3D10DeviceLock lock = LockContext(); - - m_state.pr.predicateObject = static_cast(pPredicate); + + auto predicate = static_cast(pPredicate); + m_state.pr.predicateObject = predicate; m_state.pr.predicateValue = PredicateValue; + + if (!m_device->features().extConditionalRendering.conditionalRendering) + return; + + EmitCs([ + cPredicate = predicate + ? predicate->GetPredicate() + : DxvkBufferSlice(), + cValue = PredicateValue + ] (DxvkContext* ctx) { + ctx->setPredicate(cPredicate, + cValue ? VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT : 0); + }); } diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index 7a6b9907c..0f77c9004 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -44,6 +44,10 @@ namespace dxvk { void* pData, UINT GetDataFlags); + DxvkBufferSlice GetPredicate() const { + return m_predicate; + } + D3D10Query* GetD3D10Iface() { return &m_d3d10; }