mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[d3d11] Add class to implement D3DDeviceContextState
This commit is contained in:
parent
81229d66cc
commit
c1929ccb6f
43
src/d3d11/d3d11_state_object.cpp
Normal file
43
src/d3d11/d3d11_state_object.cpp
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
47
src/d3d11/d3d11_state_object.h
Normal file
47
src/d3d11/d3d11_state_object.h
Normal file
@ -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<ID3DDeviceContextState> {
|
||||
|
||||
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<ID3D11Device> m_device;
|
||||
D3D11ContextState m_state;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user