diff --git a/src/d3d10/d3d10_device.cpp b/src/d3d10/d3d10_device.cpp new file mode 100644 index 000000000..8cfbbbac1 --- /dev/null +++ b/src/d3d10/d3d10_device.cpp @@ -0,0 +1,822 @@ +#include "d3d10_device.h" + +#include "../d3d11/d3d11_device.h" +#include "../d3d11/d3d11_context_imm.h" + +namespace dxvk { + + D3D10Device::D3D10Device( + D3D11Device* pDevice, + D3D11ImmediateContext* pContext) + : m_device(pDevice), m_context(pContext) { + + } + + + D3D10Device::~D3D10Device() { + + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::QueryInterface( + REFIID riid, + void** ppvObject) { + return m_device->QueryInterface(riid, ppvObject); + } + + + ULONG STDMETHODCALLTYPE D3D10Device::AddRef() { + // TODO implement properly + return m_device->AddRef(); + } + + + ULONG STDMETHODCALLTYPE D3D10Device::Release() { + // TODO implement properly + return m_device->Release(); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::GetPrivateData( + REFGUID guid, + UINT* pDataSize, + void* pData) { + // TODO implement properly + return m_device->GetPrivateData(guid, pDataSize, pData); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::SetPrivateData( + REFGUID guid, + UINT DataSize, + const void* pData) { + // TODO implement properly + return m_device->SetPrivateData(guid, DataSize, pData); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::SetPrivateDataInterface( + REFGUID guid, + const IUnknown* pData) { + // TODO implement properly + return m_device->SetPrivateDataInterface(guid, pData); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::GetDeviceRemovedReason() { + return m_device->GetDeviceRemovedReason(); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::SetExceptionMode( + UINT RaiseFlags) { + return m_device->SetExceptionMode(RaiseFlags); + } + + + UINT STDMETHODCALLTYPE D3D10Device::GetExceptionMode() { + return m_device->GetExceptionMode(); + } + + + D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE D3D10Device::GetFeatureLevel() { + // TODO implement properly + return D3D10_FEATURE_LEVEL1(m_device->GetFeatureLevel()); + } + + + void STDMETHODCALLTYPE D3D10Device::ClearState() { + // TODO implement properly + m_context->ClearState(); + } + + + void STDMETHODCALLTYPE D3D10Device::Flush() { + m_context->Flush(); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateBuffer( + const D3D10_BUFFER_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Buffer** ppBuffer) { + Logger::err("D3D10Device::CreateBuffer: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateTexture1D( + const D3D10_TEXTURE1D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture1D** ppTexture1D) { + Logger::err("D3D10Device::CreateTexture1D: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateTexture2D( + const D3D10_TEXTURE2D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture2D** ppTexture2D) { + Logger::err("D3D10Device::CreateTexture2D: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateTexture3D( + const D3D10_TEXTURE3D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture3D** ppTexture3D) { + Logger::err("D3D10Device::CreateTexture3D: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateShaderResourceView( + ID3D10Resource* pResource, + const D3D10_SHADER_RESOURCE_VIEW_DESC* pDesc, + ID3D10ShaderResourceView** ppSRView) { + Logger::err("D3D10Device::CreateShaderResourceView: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateShaderResourceView1( + ID3D10Resource* pResource, + const D3D10_SHADER_RESOURCE_VIEW_DESC1* pDesc, + ID3D10ShaderResourceView1** ppSRView) { + Logger::err("D3D10Device::CreateShaderResourceView1: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateRenderTargetView( + ID3D10Resource* pResource, + const D3D10_RENDER_TARGET_VIEW_DESC* pDesc, + ID3D10RenderTargetView** ppRTView) { + Logger::err("D3D10Device::CreateRenderTargetView: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateDepthStencilView( + ID3D10Resource* pResource, + const D3D10_DEPTH_STENCIL_VIEW_DESC* pDesc, + ID3D10DepthStencilView** ppDepthStencilView) { + Logger::err("D3D10Device::CreateDepthStencilView: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateInputLayout( + const D3D10_INPUT_ELEMENT_DESC* pInputElementDescs, + UINT NumElements, + const void* pShaderBytecodeWithInputSignature, + SIZE_T BytecodeLength, + ID3D10InputLayout** ppInputLayout) { + Logger::err("D3D10Device::CreateInputLayout: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateVertexShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10VertexShader** ppVertexShader) { + Logger::err("D3D10Device::CreateVertexShader: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateGeometryShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10GeometryShader** ppGeometryShader) { + Logger::err("D3D10Device::CreateGeometryShader: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateGeometryShaderWithStreamOutput( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + const D3D10_SO_DECLARATION_ENTRY* pSODeclaration, + UINT NumEntries, + UINT OutputStreamStride, + ID3D10GeometryShader** ppGeometryShader) { + Logger::err("D3D10Device::CreateGeometryShaderWithStreamOutput: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreatePixelShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10PixelShader** ppPixelShader) { + Logger::err("D3D10Device::CreatePixelShader: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateBlendState( + const D3D10_BLEND_DESC* pBlendStateDesc, + ID3D10BlendState** ppBlendState) { + Logger::err("D3D10Device::CreateBlendState: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateBlendState1( + const D3D10_BLEND_DESC1* pBlendStateDesc, + ID3D10BlendState1** ppBlendState) { + Logger::err("D3D10Device::CreateBlendState1: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateDepthStencilState( + const D3D10_DEPTH_STENCIL_DESC* pDepthStencilDesc, + ID3D10DepthStencilState** ppDepthStencilState) { + Logger::err("D3D10Device::CreateDepthStencilState: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateRasterizerState( + const D3D10_RASTERIZER_DESC* pRasterizerDesc, + ID3D10RasterizerState** ppRasterizerState) { + Logger::err("D3D10Device::CreateRasterizerState: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateSamplerState( + const D3D10_SAMPLER_DESC* pSamplerDesc, + ID3D10SamplerState** ppSamplerState) { + Logger::err("D3D10Device::CreateSamplerState: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateQuery( + const D3D10_QUERY_DESC* pQueryDesc, + ID3D10Query** ppQuery) { + Logger::err("D3D10Device::CreateQuery: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreatePredicate( + const D3D10_QUERY_DESC* pPredicateDesc, + ID3D10Predicate** ppPredicate) { + Logger::err("D3D10Device::CreatePredicate: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CreateCounter( + const D3D10_COUNTER_DESC* pCounterDesc, + ID3D10Counter** ppCounter) { + Logger::err("D3D10Device::CreateCounter: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CheckFormatSupport( + DXGI_FORMAT Format, + UINT* pFormatSupport) { + Logger::err("D3D10Device::CheckFormatSupport: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CheckMultisampleQualityLevels( + DXGI_FORMAT Format, + UINT SampleCount, + UINT* pNumQualityLevels) { + return m_device->CheckMultisampleQualityLevels( + Format, SampleCount, pNumQualityLevels); + } + + + void STDMETHODCALLTYPE D3D10Device::CheckCounterInfo( + D3D10_COUNTER_INFO* pCounterInfo) { + Logger::err("D3D10Device::CheckCounterInfo: Not implemented"); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::CheckCounter( + const D3D10_COUNTER_DESC* pDesc, + D3D10_COUNTER_TYPE* pType, + UINT* pActiveCounters, + char* name, + UINT* pNameLength, + char* units, + UINT* pUnitsLength, + char* description, + UINT* pDescriptionLength) { + Logger::err("D3D10Device::CheckCounter: Not implemented"); + return E_NOTIMPL; + } + + + UINT STDMETHODCALLTYPE D3D10Device::GetCreationFlags() { + return m_device->GetCreationFlags(); + } + + + HRESULT STDMETHODCALLTYPE D3D10Device::OpenSharedResource( + HANDLE hResource, + REFIID ReturnedInterface, + void** ppResource) { + InitReturnPtr(ppResource); + + Logger::err("D3D10Device::OpenSharedResource: Not implemented"); + return E_NOTIMPL; + } + + + void STDMETHODCALLTYPE D3D10Device::ClearRenderTargetView( + ID3D10RenderTargetView* pRenderTargetView, + const FLOAT ColorRGBA[4]) { + Logger::err("D3D10Device::ClearRenderTargetView: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::ClearDepthStencilView( + ID3D10DepthStencilView* pDepthStencilView, + UINT ClearFlags, + FLOAT Depth, + UINT8 Stencil) { + Logger::err("D3D10Device::ClearDepthStencilView: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::SetPredication( + ID3D10Predicate* pPredicate, + BOOL PredicateValue) { + Logger::err("D3D10Device::SetPredication: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GetPredication( + ID3D10Predicate** ppPredicate, + BOOL* pPredicateValue) { + Logger::err("D3D10Device::GetPredication: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::CopySubresourceRegion( + ID3D10Resource* pDstResource, + UINT DstSubresource, + UINT DstX, + UINT DstY, + UINT DstZ, + ID3D10Resource* pSrcResource, + UINT SrcSubresource, + const D3D10_BOX* pSrcBox) { + Logger::err("D3D10Device::CopySubresourceRegion: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::CopyResource( + ID3D10Resource* pDstResource, + ID3D10Resource* pSrcResource) { + Logger::err("D3D10Device::CopyResource: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::UpdateSubresource( + ID3D10Resource* pDstResource, + UINT DstSubresource, + const D3D10_BOX* pDstBox, + const void* pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch) { + Logger::err("D3D10Device::UpdateSubresource: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GenerateMips( + ID3D10ShaderResourceView* pShaderResourceView) { + Logger::err("D3D10Device::GenerateMips: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::ResolveSubresource( + ID3D10Resource* pDstResource, + UINT DstSubresource, + ID3D10Resource* pSrcResource, + UINT SrcSubresource, + DXGI_FORMAT Format) { + Logger::err("D3D10Device::ResolveSubresource: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::Draw( + UINT VertexCount, + UINT StartVertexLocation) { + m_context->Draw(VertexCount, + StartVertexLocation); + } + + + void STDMETHODCALLTYPE D3D10Device::DrawIndexed( + UINT IndexCount, + UINT StartIndexLocation, + INT BaseVertexLocation) { + m_context->DrawIndexed(IndexCount, + StartIndexLocation, + BaseVertexLocation); + } + + + void STDMETHODCALLTYPE D3D10Device::DrawInstanced( + UINT VertexCountPerInstance, + UINT InstanceCount, + UINT StartVertexLocation, + UINT StartInstanceLocation) { + m_context->DrawInstanced( + VertexCountPerInstance, + InstanceCount, + StartVertexLocation, + StartInstanceLocation); + } + + + void STDMETHODCALLTYPE D3D10Device::DrawIndexedInstanced( + UINT IndexCountPerInstance, + UINT InstanceCount, + UINT StartIndexLocation, + INT BaseVertexLocation, + UINT StartInstanceLocation) { + m_context->DrawIndexedInstanced( + IndexCountPerInstance, + InstanceCount, + StartIndexLocation, + BaseVertexLocation, + StartInstanceLocation); + } + + + void STDMETHODCALLTYPE D3D10Device::DrawAuto() { + m_context->DrawAuto(); + } + + + void STDMETHODCALLTYPE D3D10Device::IASetInputLayout( + ID3D10InputLayout* pInputLayout) { + Logger::err("D3D10Device::IASetInputLayout: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IASetPrimitiveTopology( + D3D10_PRIMITIVE_TOPOLOGY Topology) { + Logger::err("D3D10Device::IASetPrimitiveTopology: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IASetVertexBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppVertexBuffers, + const UINT* pStrides, + const UINT* pOffsets) { + Logger::err("D3D10Device::IASetVertexBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IASetIndexBuffer( + ID3D10Buffer* pIndexBuffer, + DXGI_FORMAT Format, + UINT Offset) { + Logger::err("D3D10Device::IASetIndexBuffer: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IAGetInputLayout( + ID3D10InputLayout** ppInputLayout) { + Logger::err("D3D10Device::IAGetInputLayout: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IAGetPrimitiveTopology( + D3D10_PRIMITIVE_TOPOLOGY* pTopology) { + Logger::err("D3D10Device::IAGetPrimitiveTopology: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IAGetVertexBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppVertexBuffers, + UINT* pStrides, + UINT* pOffsets) { + Logger::err("D3D10Device::IAGetVertexBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::IAGetIndexBuffer( + ID3D10Buffer** pIndexBuffer, + DXGI_FORMAT* Format, + UINT* Offset) { + Logger::err("D3D10Device::IAGetIndexBuffer: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSSetShader( + ID3D10VertexShader* pVertexShader) { + Logger::err("D3D10Device::VSSetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers) { + Logger::err("D3D10Device::VSSetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews) { + Logger::err("D3D10Device::VSSetShaderResources: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers) { + Logger::err("D3D10Device::VSSetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSGetShader( + ID3D10VertexShader** ppVertexShader) { + Logger::err("D3D10Device::VSGetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers) { + Logger::err("D3D10Device::VSGetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews) { + Logger::err("D3D10Device::VSGetShaderResources: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::VSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers) { + Logger::err("D3D10Device::VSGetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSSetShader( + ID3D10GeometryShader* pShader) { + Logger::err("D3D10Device::GSSetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers) { + Logger::err("D3D10Device::GSSetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews) { + Logger::err("D3D10Device::GSSetShaderResources: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers) { + Logger::err("D3D10Device::GSSetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSGetShader( + ID3D10GeometryShader** ppGeometryShader) { + Logger::err("D3D10Device::GSGetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers) { + Logger::err("D3D10Device::GSGetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews) { + Logger::err("D3D10Device::GSGetShaderResources: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers) { + Logger::err("D3D10Device::GSGetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSSetShader( + ID3D10PixelShader* pPixelShader) { + Logger::err("D3D10Device::PSSetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers) { + Logger::err("D3D10Device::PSSetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews) { + Logger::err("D3D10Device::PSSetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers) { + Logger::err("D3D10Device::PSSetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSGetShader( + ID3D10PixelShader** ppPixelShader) { + Logger::err("D3D10Device::PSGetShader: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers) { + Logger::err("D3D10Device::PSGetConstantBuffers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews) { + Logger::err("D3D10Device::PSGetShaderResources: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::PSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers) { + Logger::err("D3D10Device::PSGetSamplers: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMSetRenderTargets( + UINT NumViews, + ID3D10RenderTargetView* const* ppRenderTargetViews, + ID3D10DepthStencilView* pDepthStencilView) { + Logger::err("D3D10Device::OMSetRenderTargets: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMSetBlendState( + ID3D10BlendState* pBlendState, + const FLOAT BlendFactor[4], + UINT SampleMask) { + Logger::err("D3D10Device::OMSetBlendState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMSetDepthStencilState( + ID3D10DepthStencilState* pDepthStencilState, + UINT StencilRef) { + Logger::err("D3D10Device::OMSetDepthStencilState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMGetRenderTargets( + UINT NumViews, + ID3D10RenderTargetView** ppRenderTargetViews, + ID3D10DepthStencilView** ppDepthStencilView) { + Logger::err("D3D10Device::OMGetRenderTargets: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMGetBlendState( + ID3D10BlendState** ppBlendState, + FLOAT BlendFactor[4], + UINT* pSampleMask) { + Logger::err("D3D10Device::OMGetBlendState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::OMGetDepthStencilState( + ID3D10DepthStencilState** ppDepthStencilState, + UINT* pStencilRef) { + Logger::err("D3D10Device::OMGetDepthStencilState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSSetState( + ID3D10RasterizerState* pRasterizerState) { + Logger::err("D3D10Device::RSSetState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSSetViewports( + UINT NumViewports, + const D3D10_VIEWPORT* pViewports) { + Logger::err("D3D10Device::RSSetViewports: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSSetScissorRects( + UINT NumRects, + const D3D10_RECT* pRects) { + Logger::err("D3D10Device::RSSetScissorRects: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSGetState( + ID3D10RasterizerState** ppRasterizerState) { + Logger::err("D3D10Device::RSGetState: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSGetViewports( + UINT* NumViewports, + D3D10_VIEWPORT* pViewports) { + Logger::err("D3D10Device::RSGetViewports: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::RSGetScissorRects( + UINT* NumRects, + D3D10_RECT* pRects) { + Logger::err("D3D10Device::RSGetScissorRects: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::SOSetTargets( + UINT NumBuffers, + ID3D10Buffer* const* ppSOTargets, + const UINT* pOffsets) { + Logger::err("D3D10Device::SOSetTargets: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::SOGetTargets( + UINT NumBuffers, + ID3D10Buffer** ppSOTargets, + UINT* pOffsets) { + Logger::err("D3D10Device::SOGetTargets: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::SetTextFilterSize( + UINT Width, + UINT Height) { + Logger::err("D3D10Device::SetTextFilterSize: Not implemented"); + } + + + void STDMETHODCALLTYPE D3D10Device::GetTextFilterSize( + UINT* pWidth, + UINT* pHeight) { + Logger::err("D3D10Device::GetTextFilterSize: Not implemented"); + } + +} \ No newline at end of file diff --git a/src/d3d10/d3d10_device.h b/src/d3d10/d3d10_device.h new file mode 100644 index 000000000..249c24ed0 --- /dev/null +++ b/src/d3d10/d3d10_device.h @@ -0,0 +1,480 @@ +#pragma once + +#include "d3d10_include.h" + +namespace dxvk { + + class D3D11Device; + class D3D11ImmediateContext; + + class D3D10Device final : public ID3D10Device1 { + + public: + + D3D10Device( + D3D11Device* pDevice, + D3D11ImmediateContext* pContext); + + ~D3D10Device(); + + HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void** ppvObject); + + ULONG STDMETHODCALLTYPE AddRef(); + + ULONG STDMETHODCALLTYPE Release(); + + HRESULT STDMETHODCALLTYPE GetPrivateData( + REFGUID guid, + UINT* pDataSize, + void* pData); + + HRESULT STDMETHODCALLTYPE SetPrivateData( + REFGUID guid, + UINT DataSize, + const void* pData); + + HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + REFGUID guid, + const IUnknown* pData); + + HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(); + + HRESULT STDMETHODCALLTYPE SetExceptionMode( + UINT RaiseFlags); + + UINT STDMETHODCALLTYPE GetExceptionMode(); + + D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE GetFeatureLevel(); + + void STDMETHODCALLTYPE ClearState(); + + void STDMETHODCALLTYPE Flush(); + + HRESULT STDMETHODCALLTYPE CreateBuffer( + const D3D10_BUFFER_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Buffer** ppBuffer); + + HRESULT STDMETHODCALLTYPE CreateTexture1D( + const D3D10_TEXTURE1D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture1D** ppTexture1D); + + HRESULT STDMETHODCALLTYPE CreateTexture2D( + const D3D10_TEXTURE2D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture2D** ppTexture2D); + + HRESULT STDMETHODCALLTYPE CreateTexture3D( + const D3D10_TEXTURE3D_DESC* pDesc, + const D3D10_SUBRESOURCE_DATA* pInitialData, + ID3D10Texture3D** ppTexture3D); + + HRESULT STDMETHODCALLTYPE CreateShaderResourceView( + ID3D10Resource* pResource, + const D3D10_SHADER_RESOURCE_VIEW_DESC* pDesc, + ID3D10ShaderResourceView** ppSRView); + + HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( + ID3D10Resource* pResource, + const D3D10_SHADER_RESOURCE_VIEW_DESC1* pDesc, + ID3D10ShaderResourceView1** ppSRView); + + HRESULT STDMETHODCALLTYPE CreateRenderTargetView( + ID3D10Resource* pResource, + const D3D10_RENDER_TARGET_VIEW_DESC* pDesc, + ID3D10RenderTargetView** ppRTView); + + HRESULT STDMETHODCALLTYPE CreateDepthStencilView( + ID3D10Resource* pResource, + const D3D10_DEPTH_STENCIL_VIEW_DESC* pDesc, + ID3D10DepthStencilView** ppDepthStencilView); + + HRESULT STDMETHODCALLTYPE CreateInputLayout( + const D3D10_INPUT_ELEMENT_DESC* pInputElementDescs, + UINT NumElements, + const void* pShaderBytecodeWithInputSignature, + SIZE_T BytecodeLength, + ID3D10InputLayout** ppInputLayout); + + HRESULT STDMETHODCALLTYPE CreateVertexShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10VertexShader** ppVertexShader); + + HRESULT STDMETHODCALLTYPE CreateGeometryShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10GeometryShader** ppGeometryShader); + + HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + const D3D10_SO_DECLARATION_ENTRY* pSODeclaration, + UINT NumEntries, + UINT OutputStreamStride, + ID3D10GeometryShader** ppGeometryShader); + + HRESULT STDMETHODCALLTYPE CreatePixelShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10PixelShader** ppPixelShader); + + HRESULT STDMETHODCALLTYPE CreateBlendState( + const D3D10_BLEND_DESC* pBlendStateDesc, + ID3D10BlendState** ppBlendState); + + HRESULT STDMETHODCALLTYPE CreateBlendState1( + const D3D10_BLEND_DESC1* pBlendStateDesc, + ID3D10BlendState1** ppBlendState); + + HRESULT STDMETHODCALLTYPE CreateDepthStencilState( + const D3D10_DEPTH_STENCIL_DESC* pDepthStencilDesc, + ID3D10DepthStencilState** ppDepthStencilState); + + HRESULT STDMETHODCALLTYPE CreateRasterizerState( + const D3D10_RASTERIZER_DESC* pRasterizerDesc, + ID3D10RasterizerState** ppRasterizerState); + + HRESULT STDMETHODCALLTYPE CreateSamplerState( + const D3D10_SAMPLER_DESC* pSamplerDesc, + ID3D10SamplerState** ppSamplerState); + + HRESULT STDMETHODCALLTYPE CreateQuery( + const D3D10_QUERY_DESC* pQueryDesc, + ID3D10Query** ppQuery); + + HRESULT STDMETHODCALLTYPE CreatePredicate( + const D3D10_QUERY_DESC* pPredicateDesc, + ID3D10Predicate** ppPredicate); + + HRESULT STDMETHODCALLTYPE CreateCounter( + const D3D10_COUNTER_DESC* pCounterDesc, + ID3D10Counter** ppCounter); + + HRESULT STDMETHODCALLTYPE CheckFormatSupport( + DXGI_FORMAT Format, + UINT* pFormatSupport); + + HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( + DXGI_FORMAT Format, + UINT SampleCount, + UINT* pNumQualityLevels); + + void STDMETHODCALLTYPE CheckCounterInfo( + D3D10_COUNTER_INFO* pCounterInfo); + + HRESULT STDMETHODCALLTYPE CheckCounter( + const D3D10_COUNTER_DESC* pDesc, + D3D10_COUNTER_TYPE* pType, + UINT* pActiveCounters, + char* name, + UINT* pNameLength, + char* units, + UINT* pUnitsLength, + char* description, + UINT* pDescriptionLength); + + UINT STDMETHODCALLTYPE GetCreationFlags(); + + HRESULT STDMETHODCALLTYPE OpenSharedResource( + HANDLE hResource, + REFIID ReturnedInterface, + void** ppResource); + + void STDMETHODCALLTYPE ClearRenderTargetView( + ID3D10RenderTargetView* pRenderTargetView, + const FLOAT ColorRGBA[4]); + + void STDMETHODCALLTYPE ClearDepthStencilView( + ID3D10DepthStencilView* pDepthStencilView, + UINT ClearFlags, + FLOAT Depth, + UINT8 Stencil); + + void STDMETHODCALLTYPE SetPredication( + ID3D10Predicate* pPredicate, + BOOL PredicateValue); + + void STDMETHODCALLTYPE GetPredication( + ID3D10Predicate** ppPredicate, + BOOL* pPredicateValue); + + void STDMETHODCALLTYPE CopySubresourceRegion( + ID3D10Resource* pDstResource, + UINT DstSubresource, + UINT DstX, + UINT DstY, + UINT DstZ, + ID3D10Resource* pSrcResource, + UINT SrcSubresource, + const D3D10_BOX* pSrcBox); + + void STDMETHODCALLTYPE CopyResource( + ID3D10Resource* pDstResource, + ID3D10Resource* pSrcResource); + + void STDMETHODCALLTYPE UpdateSubresource( + ID3D10Resource* pDstResource, + UINT DstSubresource, + const D3D10_BOX* pDstBox, + const void* pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch); + + void STDMETHODCALLTYPE GenerateMips( + ID3D10ShaderResourceView* pShaderResourceView); + + void STDMETHODCALLTYPE ResolveSubresource( + ID3D10Resource* pDstResource, + UINT DstSubresource, + ID3D10Resource* pSrcResource, + UINT SrcSubresource, + DXGI_FORMAT Format); + + void STDMETHODCALLTYPE Draw( + UINT VertexCount, + UINT StartVertexLocation); + + void STDMETHODCALLTYPE DrawIndexed( + UINT IndexCount, + UINT StartIndexLocation, + INT BaseVertexLocation); + + void STDMETHODCALLTYPE DrawInstanced( + UINT VertexCountPerInstance, + UINT InstanceCount, + UINT StartVertexLocation, + UINT StartInstanceLocation); + + void STDMETHODCALLTYPE DrawIndexedInstanced( + UINT IndexCountPerInstance, + UINT InstanceCount, + UINT StartIndexLocation, + INT BaseVertexLocation, + UINT StartInstanceLocation); + + void STDMETHODCALLTYPE DrawAuto(); + + void STDMETHODCALLTYPE IASetInputLayout( + ID3D10InputLayout* pInputLayout); + + void STDMETHODCALLTYPE IASetPrimitiveTopology( + D3D10_PRIMITIVE_TOPOLOGY Topology); + + void STDMETHODCALLTYPE IASetVertexBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppVertexBuffers, + const UINT* pStrides, + const UINT* pOffsets); + + void STDMETHODCALLTYPE IASetIndexBuffer( + ID3D10Buffer* pIndexBuffer, + DXGI_FORMAT Format, + UINT Offset); + + void STDMETHODCALLTYPE IAGetInputLayout( + ID3D10InputLayout** ppInputLayout); + + void STDMETHODCALLTYPE IAGetPrimitiveTopology( + D3D10_PRIMITIVE_TOPOLOGY* pTopology); + + void STDMETHODCALLTYPE IAGetVertexBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppVertexBuffers, + UINT* pStrides, + UINT* pOffsets); + + void STDMETHODCALLTYPE IAGetIndexBuffer( + ID3D10Buffer** pIndexBuffer, + DXGI_FORMAT* Format, + UINT* Offset); + + void STDMETHODCALLTYPE VSSetShader( + ID3D10VertexShader* pVertexShader); + + void STDMETHODCALLTYPE VSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers); + + void STDMETHODCALLTYPE VSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews); + + void STDMETHODCALLTYPE VSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers); + + void STDMETHODCALLTYPE VSGetShader( + ID3D10VertexShader** ppVertexShader); + + void STDMETHODCALLTYPE VSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers); + + void STDMETHODCALLTYPE VSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews); + + void STDMETHODCALLTYPE VSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers); + + void STDMETHODCALLTYPE GSSetShader( + ID3D10GeometryShader* pShader); + + void STDMETHODCALLTYPE GSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers); + + void STDMETHODCALLTYPE GSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews); + + void STDMETHODCALLTYPE GSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers); + + void STDMETHODCALLTYPE GSGetShader( + ID3D10GeometryShader** ppGeometryShader); + + void STDMETHODCALLTYPE GSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers); + + void STDMETHODCALLTYPE GSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews); + + void STDMETHODCALLTYPE GSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers); + + void STDMETHODCALLTYPE PSSetShader( + ID3D10PixelShader* pPixelShader); + + void STDMETHODCALLTYPE PSSetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer* const* ppConstantBuffers); + + void STDMETHODCALLTYPE PSSetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView* const* ppShaderResourceViews); + + void STDMETHODCALLTYPE PSSetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState* const* ppSamplers); + + void STDMETHODCALLTYPE PSGetShader( + ID3D10PixelShader** ppPixelShader); + + void STDMETHODCALLTYPE PSGetConstantBuffers( + UINT StartSlot, + UINT NumBuffers, + ID3D10Buffer** ppConstantBuffers); + + void STDMETHODCALLTYPE PSGetShaderResources( + UINT StartSlot, + UINT NumViews, + ID3D10ShaderResourceView** ppShaderResourceViews); + + void STDMETHODCALLTYPE PSGetSamplers( + UINT StartSlot, + UINT NumSamplers, + ID3D10SamplerState** ppSamplers); + + void STDMETHODCALLTYPE OMSetRenderTargets( + UINT NumViews, + ID3D10RenderTargetView* const* ppRenderTargetViews, + ID3D10DepthStencilView* pDepthStencilView); + + void STDMETHODCALLTYPE OMSetBlendState( + ID3D10BlendState* pBlendState, + const FLOAT BlendFactor[4], + UINT SampleMask); + + void STDMETHODCALLTYPE OMSetDepthStencilState( + ID3D10DepthStencilState* pDepthStencilState, + UINT StencilRef); + + void STDMETHODCALLTYPE OMGetRenderTargets( + UINT NumViews, + ID3D10RenderTargetView** ppRenderTargetViews, + ID3D10DepthStencilView** ppDepthStencilView); + + void STDMETHODCALLTYPE OMGetBlendState( + ID3D10BlendState** ppBlendState, + FLOAT BlendFactor[4], + UINT* pSampleMask); + + void STDMETHODCALLTYPE OMGetDepthStencilState( + ID3D10DepthStencilState** ppDepthStencilState, + UINT* pStencilRef); + + void STDMETHODCALLTYPE RSSetState( + ID3D10RasterizerState* pRasterizerState); + + void STDMETHODCALLTYPE RSSetViewports( + UINT NumViewports, + const D3D10_VIEWPORT* pViewports); + + void STDMETHODCALLTYPE RSSetScissorRects( + UINT NumRects, + const D3D10_RECT* pRects); + + void STDMETHODCALLTYPE RSGetState( + ID3D10RasterizerState** ppRasterizerState); + + void STDMETHODCALLTYPE RSGetViewports( + UINT* NumViewports, + D3D10_VIEWPORT* pViewports); + + void STDMETHODCALLTYPE RSGetScissorRects( + UINT* NumRects, + D3D10_RECT* pRects); + + void STDMETHODCALLTYPE SOSetTargets( + UINT NumBuffers, + ID3D10Buffer* const* ppSOTargets, + const UINT* pOffsets); + + void STDMETHODCALLTYPE SOGetTargets( + UINT NumBuffers, + ID3D10Buffer** ppSOTargets, + UINT* pOffsets); + + void STDMETHODCALLTYPE SetTextFilterSize( + UINT Width, + UINT Height); + + void STDMETHODCALLTYPE GetTextFilterSize( + UINT* pWidth, + UINT* pHeight); + + private: + + D3D11Device* m_device; + D3D11ImmediateContext* m_context; + + }; + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index c9f3c0794..c6a0e6a2e 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -55,6 +55,12 @@ namespace dxvk { return S_OK; } + if (riid == __uuidof(ID3D10Device) + || riid == __uuidof(ID3D10Device1)) { + *ppvObject = ref(m_d3d11Device->GetD3D10Interface()); + return S_OK; + } + if (riid == __uuidof(ID3D11Device) || riid == __uuidof(ID3D11Device1)) { *ppvObject = ref(m_d3d11Device); @@ -108,11 +114,13 @@ namespace dxvk { m_initializer = new D3D11Initializer(m_dxvkDevice); m_uavCounters = new D3D11UavCounterAllocator(this); - m_context = new D3D11ImmediateContext(this, m_dxvkDevice); + m_context = new D3D11ImmediateContext(this, m_dxvkDevice); + m_d3d10Device = new D3D10Device(this, m_context); } D3D11Device::~D3D11Device() { + delete m_d3d10Device; delete m_context; delete m_uavCounters; delete m_initializer; diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index 1435342e9..a153ea6c9 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -7,6 +7,8 @@ #include "../dxgi/dxgi_object.h" +#include "../d3d10/d3d10_device.h" + #include "../util/com/com_private_data.h" #include "d3d11_initializer.h" @@ -340,6 +342,10 @@ namespace dxvk { const D3D11Options* GetOptions() const { return &m_d3d11Options; } + + D3D10Device* GetD3D10Interface() const { + return m_d3d10Device; + } static bool CheckFeatureLevelSupport( const Rc& adapter, @@ -366,6 +372,7 @@ namespace dxvk { D3D11Initializer* m_initializer = nullptr; D3D11UavCounterAllocator* m_uavCounters = nullptr; D3D11ImmediateContext* m_context = nullptr; + D3D10Device* m_d3d10Device = nullptr; D3D11StateObjectSet m_bsStateObjects; D3D11StateObjectSet m_dsStateObjects; diff --git a/src/d3d11/meson.build b/src/d3d11/meson.build index 3efc6e449..d381864c5 100644 --- a/src/d3d11/meson.build +++ b/src/d3d11/meson.build @@ -1,3 +1,7 @@ +d3d10_src = [ + '../d3d10/d3d10_device.cpp', +] + d3d11_src = [ 'd3d11_annotation.cpp', 'd3d11_blend.cpp', @@ -31,7 +35,7 @@ d3d11_src = [ 'd3d11_view_uav.cpp', ] -d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src, +d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src + d3d10_src, name_prefix : '', link_with : [ util_lib ], dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],