From 5b1311b71ea3abe8e73e1bcc13fb8c644c8fb538 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 23 Jan 2018 09:23:31 +0100 Subject: [PATCH] [d3d11] Added stubs for deferred contexts and command lists --- src/d3d11/d3d11_cmdlist.cpp | 37 ++++++++++++++++++ src/d3d11/d3d11_cmdlist.h | 35 +++++++++++++++++ src/d3d11/d3d11_context.cpp | 8 ++-- src/d3d11/d3d11_context.h | 4 +- src/d3d11/d3d11_context_def.cpp | 67 +++++++++++++++++++++++++++++++++ src/d3d11/d3d11_context_def.h | 49 ++++++++++++++++++++++++ src/d3d11/d3d11_context_imm.cpp | 8 ++-- src/d3d11/d3d11_context_imm.h | 6 +-- src/d3d11/d3d11_device.cpp | 5 ++- src/d3d11/meson.build | 2 + 10 files changed, 206 insertions(+), 15 deletions(-) create mode 100644 src/d3d11/d3d11_cmdlist.cpp create mode 100644 src/d3d11/d3d11_cmdlist.h create mode 100644 src/d3d11/d3d11_context_def.cpp create mode 100644 src/d3d11/d3d11_context_def.h diff --git a/src/d3d11/d3d11_cmdlist.cpp b/src/d3d11/d3d11_cmdlist.cpp new file mode 100644 index 00000000..a202fc24 --- /dev/null +++ b/src/d3d11/d3d11_cmdlist.cpp @@ -0,0 +1,37 @@ +#include "d3d11_cmdlist.h" +#include "d3d11_device.h" + +namespace dxvk { + + D3D11CommandList::D3D11CommandList( + D3D11Device* pDevice, + UINT ContextFlags) + : m_device (pDevice), + m_contextFlags(ContextFlags) { } + + + D3D11CommandList::~D3D11CommandList() { + + } + + + HRESULT STDMETHODCALLTYPE D3D11CommandList::QueryInterface(REFIID riid, void** ppvObject) { + COM_QUERY_IFACE(riid, ppvObject, IUnknown); + COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceChild); + COM_QUERY_IFACE(riid, ppvObject, ID3D11CommandList); + + Logger::warn("D3D11CommandList::QueryInterface: Unknown interface query"); + return E_NOINTERFACE; + } + + + void STDMETHODCALLTYPE D3D11CommandList::GetDevice(ID3D11Device **ppDevice) { + *ppDevice = ref(m_device); + } + + + UINT D3D11CommandList::GetContextFlags() { + return m_contextFlags; + } + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_cmdlist.h b/src/d3d11/d3d11_cmdlist.h new file mode 100644 index 00000000..091c6015 --- /dev/null +++ b/src/d3d11/d3d11_cmdlist.h @@ -0,0 +1,35 @@ +#pragma once + +#include "d3d11_device_child.h" + +namespace dxvk { + + class D3D11Device; + + class D3D11CommandList : public D3D11DeviceChild { + + public: + + D3D11CommandList( + D3D11Device* pDevice, + UINT ContextFlags); + + ~D3D11CommandList(); + + HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void** ppvObject) final; + + void STDMETHODCALLTYPE GetDevice( + ID3D11Device **ppDevice) final; + + UINT GetContextFlags(); + + private: + + D3D11Device* const m_device; + UINT const m_contextFlags; + + }; + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 7421e1f1..3dad7399 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -10,10 +10,10 @@ namespace dxvk { D3D11DeviceContext::D3D11DeviceContext( - D3D11Device* parent, - Rc device) - : m_parent (parent), - m_device (device), + D3D11Device* pParent, + Rc Device) + : m_parent (pParent), + m_device (Device), m_csChunk (new DxvkCsChunk()) { // Create default state objects. We won't ever return them // to the application, but we'll use them to apply state. diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 1b230079..ddf1cec2 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -17,8 +17,8 @@ namespace dxvk { public: D3D11DeviceContext( - D3D11Device* parent, - Rc device); + D3D11Device* pParent, + Rc Device); ~D3D11DeviceContext(); HRESULT STDMETHODCALLTYPE QueryInterface( diff --git a/src/d3d11/d3d11_context_def.cpp b/src/d3d11/d3d11_context_def.cpp new file mode 100644 index 00000000..957e9d14 --- /dev/null +++ b/src/d3d11/d3d11_context_def.cpp @@ -0,0 +1,67 @@ +#include "d3d11_context_def.h" + +namespace dxvk { + + D3D11DeferredContext::D3D11DeferredContext( + D3D11Device* pParent, + Rc Device, + UINT ContextFlags) + : D3D11DeviceContext(pParent, Device), + m_contextFlags(ContextFlags) { + + } + + + D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE D3D11DeferredContext::GetType() { + return D3D11_DEVICE_CONTEXT_DEFERRED; + } + + + UINT STDMETHODCALLTYPE D3D11DeferredContext::GetContextFlags() { + return m_contextFlags; + } + + + void STDMETHODCALLTYPE D3D11DeferredContext::Flush() { + Logger::err("D3D11: Flush called on a deferred context"); + } + + + void STDMETHODCALLTYPE D3D11DeferredContext::ExecuteCommandList( + ID3D11CommandList* pCommandList, + WINBOOL RestoreContextState) { + Logger::err("D3D11DeferredContext::ExecuteCommandList: Not implemented"); + } + + + HRESULT STDMETHODCALLTYPE D3D11DeferredContext::FinishCommandList( + WINBOOL RestoreDeferredContextState, + ID3D11CommandList **ppCommandList) { + Logger::err("D3D11DeferredContext::FinishCommandList: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D11DeferredContext::Map( + ID3D11Resource* pResource, + UINT Subresource, + D3D11_MAP MapType, + UINT MapFlags, + D3D11_MAPPED_SUBRESOURCE* pMappedResource) { + Logger::err("D3D11DeferredContext::Map: Not implemented"); + return E_NOTIMPL; + } + + + void STDMETHODCALLTYPE D3D11DeferredContext::Unmap( + ID3D11Resource* pResource, + UINT Subresource) { + Logger::err("D3D11DeferredContext::Unmap: Not implemented"); + } + + + void D3D11DeferredContext::EmitCsChunk() { + + } + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_context_def.h b/src/d3d11/d3d11_context_def.h new file mode 100644 index 00000000..a29fb653 --- /dev/null +++ b/src/d3d11/d3d11_context_def.h @@ -0,0 +1,49 @@ +#pragma once + +#include "d3d11_context.h" + +namespace dxvk { + + class D3D11DeferredContext : public D3D11DeviceContext { + + public: + + D3D11DeferredContext( + D3D11Device* pParent, + Rc Device, + UINT ContextFlags); + + D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType() final; + + UINT STDMETHODCALLTYPE GetContextFlags() final; + + void STDMETHODCALLTYPE Flush() final; + + void STDMETHODCALLTYPE ExecuteCommandList( + ID3D11CommandList* pCommandList, + WINBOOL RestoreContextState) final; + + HRESULT STDMETHODCALLTYPE FinishCommandList( + WINBOOL RestoreDeferredContextState, + ID3D11CommandList **ppCommandList) final; + + HRESULT STDMETHODCALLTYPE Map( + ID3D11Resource* pResource, + UINT Subresource, + D3D11_MAP MapType, + UINT MapFlags, + D3D11_MAPPED_SUBRESOURCE* pMappedResource) final; + + void STDMETHODCALLTYPE Unmap( + ID3D11Resource* pResource, + UINT Subresource) final; + + private: + + const UINT m_contextFlags; + + void EmitCsChunk() final; + + }; + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 1c463732..36915b3e 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -5,10 +5,10 @@ namespace dxvk { D3D11ImmediateContext::D3D11ImmediateContext( - D3D11Device* parent, - Rc device) - : D3D11DeviceContext(parent, device), - m_csThread(device->createContext()) { + D3D11Device* pParent, + Rc Device) + : D3D11DeviceContext(pParent, Device), + m_csThread(Device->createContext()) { } diff --git a/src/d3d11/d3d11_context_imm.h b/src/d3d11/d3d11_context_imm.h index fa8dcdf4..57f9879f 100644 --- a/src/d3d11/d3d11_context_imm.h +++ b/src/d3d11/d3d11_context_imm.h @@ -9,8 +9,8 @@ namespace dxvk { public: D3D11ImmediateContext( - D3D11Device* parent, - Rc device); + D3D11Device* pParent, + Rc Device); ~D3D11ImmediateContext(); ULONG STDMETHODCALLTYPE AddRef() final; @@ -50,7 +50,7 @@ namespace dxvk { void SynchronizeDevice(); - void EmitCsChunk(); + void EmitCsChunk() final; }; diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 8caf7eb3..6855706d 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -2,6 +2,7 @@ #include "d3d11_buffer.h" #include "d3d11_class_linkage.h" +#include "d3d11_context_def.h" #include "d3d11_context_imm.h" #include "d3d11_device.h" #include "d3d11_input_layout.h" @@ -1095,8 +1096,8 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext( UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext) { - Logger::err("D3D11Device::CreateDeferredContext: Not implemented"); - return E_NOTIMPL; + *ppDeferredContext = ref(new D3D11DeferredContext(this, m_dxvkDevice, ContextFlags)); + return S_OK; } diff --git a/src/d3d11/meson.build b/src/d3d11/meson.build index 6f78f852..44aba205 100644 --- a/src/d3d11/meson.build +++ b/src/d3d11/meson.build @@ -2,7 +2,9 @@ d3d11_src = [ 'd3d11_blend.cpp', 'd3d11_buffer.cpp', 'd3d11_class_linkage.cpp', + 'd3d11_cmdlist.cpp', 'd3d11_context.cpp', + 'd3d11_context_def.cpp', 'd3d11_context_imm.cpp', 'd3d11_depth_stencil.cpp', 'd3d11_device.cpp',