From a3e7139c1ec4fa93e241b6910ccc0881ef8f3e93 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Sat, 17 Mar 2018 20:54:09 +0300 Subject: [PATCH] [d3d11] stub implementation of ID3DDeviceContext1 (#174) --- src/d3d11/d3d11_context.cpp | 176 ++++++++++++++++++++++++++++++++++++ src/d3d11/d3d11_context.h | 125 ++++++++++++++++++++++++- 2 files changed, 300 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 47f5d2f8..565e5437 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -65,6 +65,7 @@ namespace dxvk { COM_QUERY_IFACE(riid, ppvObject, IUnknown); COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceChild); COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceContext); + COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceContext1); if (riid == __uuidof(ID3DUserDefinedAnnotation)) return E_NOINTERFACE; @@ -74,6 +75,26 @@ namespace dxvk { return E_NOINTERFACE; } + void STDMETHODCALLTYPE D3D11DeviceContext::DiscardResource(ID3D11Resource * pResource) { + Logger::err("D3D11DeviceContext::DiscardResource: Not implemented"); + } + + void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView(ID3D11View * pResourceView) { + Logger::err("D3D11DeviceContext::DiscardView: Not implemented"); + } + + void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView1( + ID3D11View* pResourceView, + const D3D11_RECT* pRects, + UINT NumRects) { + Logger::err("D3D11DeviceContext::DiscardView1: Not implemented"); + } + + void STDMETHODCALLTYPE D3D11DeviceContext::SwapDeviceContextState( + ID3DDeviceContextState* pState, + ID3DDeviceContextState** ppPreviousState) { + Logger::err("D3D11DeviceContext::SwapDeviceContextState: Not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::GetDevice(ID3D11Device **ppDevice) { *ppDevice = ref(m_parent); @@ -379,6 +400,20 @@ namespace dxvk { } } + void STDMETHODCALLTYPE D3D11DeviceContext::CopySubresourceRegion1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + UINT DstX, + UINT DstY, + UINT DstZ, + ID3D11Resource* pSrcResource, + UINT SrcSubresource, + const D3D11_BOX* pSrcBox, + UINT CopyFlags) { + if (CopyFlags != 0) + Logger::warn("D3D11DeviceContext: CopySubresourceRegion1: ignoring flags"); + CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox); + } void STDMETHODCALLTYPE D3D11DeviceContext::CopyResource( ID3D11Resource* pDstResource, @@ -608,6 +643,13 @@ namespace dxvk { }); } + void STDMETHODCALLTYPE D3D11DeviceContext::ClearView( + ID3D11View* pView, + const FLOAT Color[4], + const D3D11_RECT* pRect, + UINT NumRects) { + Logger::err("D3D11DeviceContext::ClearView: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::GenerateMips(ID3D11ShaderResourceView* pShaderResourceView) { auto view = static_cast(pShaderResourceView); @@ -740,6 +782,20 @@ namespace dxvk { }); } } + + + void STDMETHODCALLTYPE D3D11DeviceContext::UpdateSubresource1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + const D3D11_BOX* pDstBox, + const void* pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch, + UINT CopyFlags) { + if(CopyFlags != 0 ) + Logger::warn("D3D11DeviceContext::UpdateSubresource1: flags ignored"); + UpdateSubresource(pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch); + } void STDMETHODCALLTYPE D3D11DeviceContext::SetResourceMinLOD( @@ -1090,6 +1146,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::VSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::VSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::VSSetShaderResources( @@ -1135,6 +1201,16 @@ namespace dxvk { for (uint32_t i = 0; i < NumBuffers; i++) ppConstantBuffers[i] = m_state.vs.constantBuffers.at(StartSlot + i).ref(); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::VSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::VSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::VSGetShaderResources( @@ -1193,6 +1269,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::HSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::HSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::HSSetSamplers( @@ -1226,6 +1312,16 @@ namespace dxvk { for (uint32_t i = 0; i < NumBuffers; i++) ppConstantBuffers[i] = m_state.hs.constantBuffers.at(StartSlot + i).ref(); } + + + void D3D11DeviceContext::HSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::HSGetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::HSGetShaderResources( @@ -1284,6 +1380,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::DSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::DSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::DSSetSamplers( @@ -1319,6 +1425,16 @@ namespace dxvk { } + void STDMETHODCALLTYPE D3D11DeviceContext::DSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::DSGetConstantBuffers1: not implemented"); + } + + void STDMETHODCALLTYPE D3D11DeviceContext::DSGetShaderResources( UINT StartSlot, UINT NumViews, @@ -1363,6 +1479,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void D3D11DeviceContext::GSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::GSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::GSSetShaderResources( @@ -1408,6 +1534,16 @@ namespace dxvk { for (uint32_t i = 0; i < NumBuffers; i++) ppConstantBuffers[i] = m_state.gs.constantBuffers.at(StartSlot + i).ref(); } + + + void D3D11DeviceContext::GSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::GSGetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::GSGetShaderResources( @@ -1454,6 +1590,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void D3D11DeviceContext::PSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::PSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::PSSetShaderResources( @@ -1499,6 +1645,16 @@ namespace dxvk { for (uint32_t i = 0; i < NumBuffers; i++) ppConstantBuffers[i] = m_state.ps.constantBuffers.at(StartSlot + i).ref(); } + + + void D3D11DeviceContext::PSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::PSSetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::PSGetShaderResources( @@ -1545,6 +1701,16 @@ namespace dxvk { StartSlot, NumBuffers, ppConstantBuffers); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::CSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) { + Logger::err("D3D11DeviceContext::CSSetConstantBuffers1: not implemented notsupported"); + } void STDMETHODCALLTYPE D3D11DeviceContext::CSSetShaderResources( @@ -1609,6 +1775,16 @@ namespace dxvk { for (uint32_t i = 0; i < NumBuffers; i++) ppConstantBuffers[i] = m_state.cs.constantBuffers.at(StartSlot + i).ref(); } + + + void STDMETHODCALLTYPE D3D11DeviceContext::CSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) { + Logger::warn("D3D11DeviceContext::CSGetConstantBuffers1: not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::CSGetShaderResources( diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 80edabab..1cb11651 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -11,7 +11,7 @@ namespace dxvk { class D3D11Device; - class D3D11DeviceContext : public D3D11DeviceChild { + class D3D11DeviceContext : public D3D11DeviceChild { public: @@ -24,6 +24,19 @@ namespace dxvk { REFIID riid, void** ppvObject) final; + void STDMETHODCALLTYPE DiscardResource(ID3D11Resource *pResource) final; + + void STDMETHODCALLTYPE DiscardView(ID3D11View* pResourceView) final; + + void STDMETHODCALLTYPE DiscardView1( + ID3D11View* pResourceView, + const D3D11_RECT* pRects, + UINT NumRects) final; + + void STDMETHODCALLTYPE SwapDeviceContextState( + ID3DDeviceContextState* pState, + ID3DDeviceContextState** ppPreviousState) final; + void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice) final; void STDMETHODCALLTYPE ClearState() final; @@ -56,6 +69,17 @@ namespace dxvk { UINT SrcSubresource, const D3D11_BOX* pSrcBox) final; + void STDMETHODCALLTYPE CopySubresourceRegion1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + UINT DstX, + UINT DstY, + UINT DstZ, + ID3D11Resource* pSrcResource, + UINT SrcSubresource, + const D3D11_BOX* pSrcBox, + UINT CopyFlags) final; + void STDMETHODCALLTYPE CopyResource( ID3D11Resource* pDstResource, ID3D11Resource* pSrcResource) final; @@ -83,6 +107,12 @@ namespace dxvk { FLOAT Depth, UINT8 Stencil) final; + void STDMETHODCALLTYPE ClearView( + ID3D11View *pView, + const FLOAT Color[4], + const D3D11_RECT *pRect, + UINT NumRects) final; + void STDMETHODCALLTYPE GenerateMips( ID3D11ShaderResourceView* pShaderResourceView) final; @@ -94,6 +124,15 @@ namespace dxvk { UINT SrcRowPitch, UINT SrcDepthPitch) final; + void STDMETHODCALLTYPE UpdateSubresource1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + const D3D11_BOX* pDstBox, + const void* pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch, + UINT CopyFlags) final; + void STDMETHODCALLTYPE SetResourceMinLOD( ID3D11Resource* pResource, FLOAT MinLOD) final; @@ -194,6 +233,13 @@ namespace dxvk { UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + + void STDMETHODCALLTYPE VSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; void STDMETHODCALLTYPE VSSetShaderResources( UINT StartSlot, @@ -214,6 +260,13 @@ namespace dxvk { UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + + void STDMETHODCALLTYPE VSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; void STDMETHODCALLTYPE VSGetShaderResources( UINT StartSlot, @@ -240,6 +293,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + void STDMETHODCALLTYPE HSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; + void STDMETHODCALLTYPE HSSetSamplers( UINT StartSlot, UINT NumSamplers, @@ -254,6 +314,13 @@ namespace dxvk { UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + + void STDMETHODCALLTYPE HSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; void STDMETHODCALLTYPE HSGetShaderResources( UINT StartSlot, @@ -279,6 +346,13 @@ namespace dxvk { UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + + void STDMETHODCALLTYPE DSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; void STDMETHODCALLTYPE DSSetSamplers( UINT StartSlot, @@ -295,6 +369,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + void STDMETHODCALLTYPE DSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; + void STDMETHODCALLTYPE DSGetShaderResources( UINT StartSlot, UINT NumViews, @@ -315,6 +396,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + virtual void STDMETHODCALLTYPE GSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; + void STDMETHODCALLTYPE GSSetShaderResources( UINT StartSlot, UINT NumViews, @@ -335,6 +423,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + void STDMETHODCALLTYPE GSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; + void STDMETHODCALLTYPE GSGetShaderResources( UINT StartSlot, UINT NumViews, @@ -354,6 +449,13 @@ namespace dxvk { UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + + void STDMETHODCALLTYPE PSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; void STDMETHODCALLTYPE PSSetShaderResources( UINT StartSlot, @@ -375,6 +477,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + void STDMETHODCALLTYPE PSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; + void STDMETHODCALLTYPE PSGetShaderResources( UINT StartSlot, UINT NumViews, @@ -395,6 +504,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers) final; + void STDMETHODCALLTYPE CSSetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer* const* ppConstantBuffers, + const UINT* pFirstConstant, + const UINT* pNumConstants) final; + void STDMETHODCALLTYPE CSSetShaderResources( UINT StartSlot, UINT NumViews, @@ -421,6 +537,13 @@ namespace dxvk { UINT NumBuffers, ID3D11Buffer** ppConstantBuffers) final; + void STDMETHODCALLTYPE CSGetConstantBuffers1( + UINT StartSlot, + UINT NumBuffers, + ID3D11Buffer** ppConstantBuffers, + UINT* pFirstConstant, + UINT* pNumConstants) final; + void STDMETHODCALLTYPE CSGetShaderResources( UINT StartSlot, UINT NumViews,