From 95e2c641e0cb248d07eefb6bf73a4e7fbe7f2796 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 7 Mar 2018 15:32:19 +0100 Subject: [PATCH] [d3d11] Partially implement SOSetTargets/SOGetTargets This does not implement any stream output functionality yet, but it allows games to set and query stream output buffers. --- src/d3d11/d3d11_context.cpp | 12 ++++++++---- src/d3d11/d3d11_context_state.h | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index bb4c1512..5e8fbaf5 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -2035,16 +2035,20 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer* const* ppSOTargets, const UINT* pOffsets) { - if (NumBuffers > 0) - Logger::err("D3D11DeviceContext::SOSetTargets: Not implemented"); + // TODO implement properly, including pOffsets + for (uint32_t i = 0; i < D3D11_SO_STREAM_COUNT; i++) { + m_state.so.targets[i] = (ppSOTargets != nullptr && i < NumBuffers) + ? static_cast(ppSOTargets[i]) + : nullptr; + } } void STDMETHODCALLTYPE D3D11DeviceContext::SOGetTargets( UINT NumBuffers, ID3D11Buffer** ppSOTargets) { - if (NumBuffers > 0) - Logger::err("D3D11DeviceContext::SOGetTargets: Not implemented"); + for (uint32_t i = 0; i < NumBuffers; i++) + ppSOTargets[i] = m_state.so.targets[i].ref(); } diff --git a/src/d3d11/d3d11_context_state.h b/src/d3d11/d3d11_context_state.h index 2d1327cc..cf570cce 100644 --- a/src/d3d11/d3d11_context_state.h +++ b/src/d3d11/d3d11_context_state.h @@ -28,7 +28,7 @@ namespace dxvk { using D3D11UnorderedAccessBindings = std::array< Com, D3D11_1_UAV_SLOT_COUNT>; - + struct D3D11ContextStateVS { Com shader; @@ -127,6 +127,11 @@ namespace dxvk { }; + struct D3D11ContextStateSO { + std::array, D3D11_SO_STREAM_COUNT> targets; + }; + + /** * \brief Context state */ @@ -141,6 +146,7 @@ namespace dxvk { D3D11ContextStateIA ia; D3D11ContextStateOM om; D3D11ContextStateRS rs; + D3D11ContextStateSO so; }; } \ No newline at end of file