mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-01 01:54:26 +01:00
[d3d11] Move D3D11Shader implementation to its own file
And resolve some include madness. Necessary because D3D11Shader::GetDevice needs to know the full definition of D3D11Device, but D3D11Device needs to know the full definition of the other shader-related classes.
This commit is contained in:
parent
0b4489a31c
commit
56fe52ca3c
@ -6,7 +6,7 @@
|
|||||||
#include "d3d11_input_layout.h"
|
#include "d3d11_input_layout.h"
|
||||||
#include "d3d11_query.h"
|
#include "d3d11_query.h"
|
||||||
#include "d3d11_sampler.h"
|
#include "d3d11_sampler.h"
|
||||||
#include "d3d11_shader.h"
|
#include "d3d11_shader_types.h"
|
||||||
#include "d3d11_state.h"
|
#include "d3d11_state.h"
|
||||||
#include "d3d11_view_dsv.h"
|
#include "d3d11_view_dsv.h"
|
||||||
#include "d3d11_view_rtv.h"
|
#include "d3d11_view_rtv.h"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "d3d11_query.h"
|
#include "d3d11_query.h"
|
||||||
#include "d3d11_resource.h"
|
#include "d3d11_resource.h"
|
||||||
#include "d3d11_sampler.h"
|
#include "d3d11_sampler.h"
|
||||||
#include "d3d11_shader.h"
|
#include "d3d11_shader_types.h"
|
||||||
#include "d3d11_state_object.h"
|
#include "d3d11_state_object.h"
|
||||||
#include "d3d11_swapchain.h"
|
#include "d3d11_swapchain.h"
|
||||||
#include "d3d11_texture.h"
|
#include "d3d11_texture.h"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "d3d11_buffer.h"
|
#include "d3d11_buffer.h"
|
||||||
#include "d3d11_texture.h"
|
#include "d3d11_texture.h"
|
||||||
|
#include "d3d11_view_uav.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
@ -59,72 +59,6 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Common shader interface
|
|
||||||
*
|
|
||||||
* Implements methods for all D3D11*Shader
|
|
||||||
* interfaces and stores the actual shader
|
|
||||||
* module object.
|
|
||||||
*/
|
|
||||||
template<typename D3D11Interface, typename D3D10Interface>
|
|
||||||
class D3D11Shader : public D3D11DeviceChild<D3D11Interface> {
|
|
||||||
using D3D10ShaderClass = D3D10Shader<D3D10Interface, D3D11Interface>;
|
|
||||||
public:
|
|
||||||
|
|
||||||
D3D11Shader(D3D11Device* device, const D3D11CommonShader& shader)
|
|
||||||
: m_device(device), m_shader(shader), m_d3d10(this) { }
|
|
||||||
|
|
||||||
~D3D11Shader() { }
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final {
|
|
||||||
*ppvObject = nullptr;
|
|
||||||
|
|
||||||
if (riid == __uuidof(IUnknown)
|
|
||||||
|| riid == __uuidof(ID3D11DeviceChild)
|
|
||||||
|| riid == __uuidof(D3D11Interface)) {
|
|
||||||
*ppvObject = ref(this);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (riid == __uuidof(IUnknown)
|
|
||||||
|| riid == __uuidof(ID3D10DeviceChild)
|
|
||||||
|| riid == __uuidof(D3D10Interface)) {
|
|
||||||
*ppvObject = ref(&m_d3d10);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::warn("D3D11Shader::QueryInterface: Unknown interface query");
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice) final {
|
|
||||||
*ppDevice = m_device.ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
const D3D11CommonShader* GetCommonShader() const {
|
|
||||||
return &m_shader;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D10ShaderClass* GetD3D10Iface() {
|
|
||||||
return &m_d3d10;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Com<D3D11Device> m_device;
|
|
||||||
D3D11CommonShader m_shader;
|
|
||||||
D3D10ShaderClass m_d3d10;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
using D3D11VertexShader = D3D11Shader<ID3D11VertexShader, ID3D10VertexShader>;
|
|
||||||
using D3D11HullShader = D3D11Shader<ID3D11HullShader, ID3D10DeviceChild>;
|
|
||||||
using D3D11DomainShader = D3D11Shader<ID3D11DomainShader, ID3D10DeviceChild>;
|
|
||||||
using D3D11GeometryShader = D3D11Shader<ID3D11GeometryShader, ID3D10GeometryShader>;
|
|
||||||
using D3D11PixelShader = D3D11Shader<ID3D11PixelShader, ID3D10PixelShader>;
|
|
||||||
using D3D11ComputeShader = D3D11Shader<ID3D11ComputeShader, ID3D10DeviceChild>;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shader module set
|
* \brief Shader module set
|
||||||
*
|
*
|
||||||
|
73
src/d3d11/d3d11_shader_types.h
Normal file
73
src/d3d11/d3d11_shader_types.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "d3d11_device.h"
|
||||||
|
#include "d3d11_shader.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Common shader interface
|
||||||
|
*
|
||||||
|
* Implements methods for all D3D11*Shader
|
||||||
|
* interfaces and stores the actual shader
|
||||||
|
* module object.
|
||||||
|
*/
|
||||||
|
template<typename D3D11Interface, typename D3D10Interface>
|
||||||
|
class D3D11Shader : public D3D11DeviceChild<D3D11Interface> {
|
||||||
|
using D3D10ShaderClass = D3D10Shader<D3D10Interface, D3D11Interface>;
|
||||||
|
public:
|
||||||
|
|
||||||
|
D3D11Shader(D3D11Device* device, const D3D11CommonShader& shader)
|
||||||
|
: m_device(device), m_shader(shader), m_d3d10(this) { }
|
||||||
|
|
||||||
|
~D3D11Shader() { }
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final {
|
||||||
|
*ppvObject = nullptr;
|
||||||
|
|
||||||
|
if (riid == __uuidof(IUnknown)
|
||||||
|
|| riid == __uuidof(ID3D11DeviceChild)
|
||||||
|
|| riid == __uuidof(D3D11Interface)) {
|
||||||
|
*ppvObject = ref(this);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (riid == __uuidof(IUnknown)
|
||||||
|
|| riid == __uuidof(ID3D10DeviceChild)
|
||||||
|
|| riid == __uuidof(D3D10Interface)) {
|
||||||
|
*ppvObject = ref(&m_d3d10);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::warn("D3D11Shader::QueryInterface: Unknown interface query");
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice) final {
|
||||||
|
*ppDevice = m_device.ref();
|
||||||
|
}
|
||||||
|
|
||||||
|
const D3D11CommonShader* GetCommonShader() const {
|
||||||
|
return &m_shader;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3D10ShaderClass* GetD3D10Iface() {
|
||||||
|
return &m_d3d10;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Com<D3D11Device> m_device;
|
||||||
|
D3D11CommonShader m_shader;
|
||||||
|
D3D10ShaderClass m_d3d10;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
using D3D11VertexShader = D3D11Shader<ID3D11VertexShader, ID3D10VertexShader>;
|
||||||
|
using D3D11HullShader = D3D11Shader<ID3D11HullShader, ID3D10DeviceChild>;
|
||||||
|
using D3D11DomainShader = D3D11Shader<ID3D11DomainShader, ID3D10DeviceChild>;
|
||||||
|
using D3D11GeometryShader = D3D11Shader<ID3D11GeometryShader, ID3D10GeometryShader>;
|
||||||
|
using D3D11PixelShader = D3D11Shader<ID3D11PixelShader, ID3D10PixelShader>;
|
||||||
|
using D3D11ComputeShader = D3D11Shader<ID3D11ComputeShader, ID3D10DeviceChild>;
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user