diff --git a/src/d3d11/d3d11_state_object.cpp b/src/d3d11/d3d11_state_object.cpp new file mode 100644 index 00000000..8838c3fe --- /dev/null +++ b/src/d3d11/d3d11_state_object.cpp @@ -0,0 +1,43 @@ +#include "d3d11_state_object.h" + +namespace dxvk { + + D3D11DeviceContextState::D3D11DeviceContextState( + ID3D11Device* pDevice) + : m_device(pDevice) { + + } + + + D3D11DeviceContextState::~D3D11DeviceContextState() { + + } + + + HRESULT STDMETHODCALLTYPE D3D11DeviceContextState::QueryInterface( + REFIID riid, + void** ppvObject) { + if (ppvObject == nullptr) + return E_POINTER; + + *ppvObject = nullptr; + + if (riid == __uuidof(IUnknown) + || riid == __uuidof(ID3D11DeviceChild) + || riid == __uuidof(ID3DDeviceContextState)) { + *ppvObject = ref(this); + return S_OK; + } + + Logger::warn("D3D11DeviceContextState::QueryInterface: Unknown interface query"); + Logger::warn(str::format(riid)); + return E_NOINTERFACE; + } + + + void STDMETHODCALLTYPE D3D11DeviceContextState::GetDevice( + ID3D11Device** ppDevice) { + *ppDevice = m_device.ref(); + } + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_state_object.h b/src/d3d11/d3d11_state_object.h new file mode 100644 index 00000000..9eb122dc --- /dev/null +++ b/src/d3d11/d3d11_state_object.h @@ -0,0 +1,47 @@ +#pragma once + +#include "d3d11_context_state.h" +#include "d3d11_device_child.h" + +namespace dxvk { + + /** + * \brief Device context state implementation + * + * This is an opaque interface in D3D11, and we only + * implement the state block-like functionality, not + * the methods to disable certain context and device + * interfaces based on the emulated device IID. + */ + class D3D11DeviceContextState : public D3D11DeviceChild { + + public: + + D3D11DeviceContextState( + ID3D11Device* pDevice); + + ~D3D11DeviceContextState(); + + HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void** ppvObject); + + void STDMETHODCALLTYPE GetDevice( + ID3D11Device** ppDevice); + + void SetState(const D3D11ContextState& State) { + m_state = State; + } + + void GetState(D3D11ContextState& State) const { + State = m_state; + } + + private: + + Com m_device; + D3D11ContextState m_state; + + }; + +} diff --git a/src/d3d11/meson.build b/src/d3d11/meson.build index bfbe9b89..673d0957 100644 --- a/src/d3d11/meson.build +++ b/src/d3d11/meson.build @@ -47,6 +47,7 @@ d3d11_src = [ 'd3d11_sampler.cpp', 'd3d11_shader.cpp', 'd3d11_state.cpp', + 'd3d11_state_object.cpp', 'd3d11_swapchain.cpp', 'd3d11_texture.cpp', 'd3d11_util.cpp',