From 3b42011c50444f494dc6f424ef2aa999472b2b5a Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 9 Mar 2018 16:47:20 +0100 Subject: [PATCH] [d3d11] Implemented OMGetRenderTargetsAndUnorderedAccessViews and predication stub --- src/d3d11/d3d11_context.cpp | 27 ++++++++++++++++++++------- src/d3d11/d3d11_context_state.h | 8 ++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index c4e1e152..5c61f070 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -149,7 +149,7 @@ namespace dxvk { // this->SOSetTargets(0, nullptr, nullptr); -// this->SetPredication(nullptr, FALSE); + this->SetPredication(nullptr, FALSE); } @@ -226,14 +226,24 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::SetPredication( ID3D11Predicate* pPredicate, BOOL PredicateValue) { - Logger::err("D3D11DeviceContext::SetPredication: Not implemented"); + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::SetPredication: Stub"); + + m_state.pr.predicateObject = static_cast(pPredicate); + m_state.pr.predicateValue = PredicateValue; } void STDMETHODCALLTYPE D3D11DeviceContext::GetPredication( ID3D11Predicate** ppPredicate, BOOL* pPredicateValue) { - Logger::err("D3D11DeviceContext::GetPredication: Not implemented"); + if (ppPredicate != nullptr) + *ppPredicate = m_state.pr.predicateObject.ref(); + + if (pPredicateValue != nullptr) + *pPredicateValue = m_state.pr.predicateValue; } @@ -1901,9 +1911,7 @@ namespace dxvk { ID3D11DepthStencilView** ppDepthStencilView) { if (ppRenderTargetViews != nullptr) { for (UINT i = 0; i < NumViews; i++) - ppRenderTargetViews[i] = i < m_state.om.renderTargetViews.size() - ? m_state.om.renderTargetViews.at(i).ref() - : nullptr; + ppRenderTargetViews[i] = m_state.om.renderTargetViews[i].ref(); } if (ppDepthStencilView != nullptr) @@ -1918,7 +1926,12 @@ namespace dxvk { UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView** ppUnorderedAccessViews) { - Logger::err("D3D11DeviceContext::OMGetRenderTargetsAndUnorderedAccessViews: Not implemented"); + OMGetRenderTargets(NumRTVs, ppRenderTargetViews, ppDepthStencilView); + + if (ppUnorderedAccessViews != nullptr) { + for (UINT i = 0; i < NumUAVs; i++) + ppUnorderedAccessViews[i] = m_state.ps.unorderedAccessViews[UAVStartSlot + i].ref(); + } } diff --git a/src/d3d11/d3d11_context_state.h b/src/d3d11/d3d11_context_state.h index cf570cce..ed31eaf2 100644 --- a/src/d3d11/d3d11_context_state.h +++ b/src/d3d11/d3d11_context_state.h @@ -4,6 +4,7 @@ #include "d3d11_buffer.h" #include "d3d11_input_layout.h" +#include "d3d11_query.h" #include "d3d11_sampler.h" #include "d3d11_shader.h" #include "d3d11_state.h" @@ -132,6 +133,12 @@ namespace dxvk { }; + struct D3D11ContextStatePR { + Com predicateObject = nullptr; + BOOL predicateValue = FALSE; + }; + + /** * \brief Context state */ @@ -147,6 +154,7 @@ namespace dxvk { D3D11ContextStateOM om; D3D11ContextStateRS rs; D3D11ContextStateSO so; + D3D11ContextStatePR pr; }; } \ No newline at end of file