[d3d11] Added stubs for shader classes

This commit is contained in:
Philip Rebohle 2017-12-06 14:16:14 +01:00
parent c7e1131864
commit 8934ab0fc7
6 changed files with 133 additions and 2 deletions

View File

@ -1003,7 +1003,7 @@ namespace dxvk {
// state is not explicitly defined.
m_context->setRasterizerState(
rasterizerState != nullptr
? rasterizerState->GetDXVKStateObject()
? rasterizerState->GetDXVKRasterizerState()
: m_defaultRsState);
// In D3D11, the rasterizer state defines

View File

@ -2,11 +2,69 @@
#include <array>
#include "d3d11_buffer.h"
#include "d3d11_shader.h"
#include "d3d11_state.h"
#include "d3d11_view.h"
namespace dxvk {
struct D3D11ComputePipelineBindings {
std::array<Com<D3D11Buffer>, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT> constantBuffers;
// std::array<Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> shaderResourceViews;
// std::array<Com<D3D11UnorderedAccessView>, D3D11_1_UAV_SLOT_COUNT> uniformAccessViews;
// std::array<Com<D3D11SamplerState>, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT> samplers;
};
struct D3D11GraphicsPipelineBindings {
std::array<Com<D3D11Buffer>, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT> constantBuffers;
// std::array<Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> shaderResourceViews;
// std::array<Com<D3D11SamplerState>, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT> samplers;
};
struct D3D11ContextStateVS {
Com<D3D11VertexShader> shader;
D3D11GraphicsPipelineBindings bindings;
};
struct D3D11ContextStateHS {
Com<D3D11HullShader> shader;
D3D11GraphicsPipelineBindings bindings;
};
struct D3D11ContextStateDS {
Com<D3D11DomainShader> shader;
D3D11GraphicsPipelineBindings bindings;
};
struct D3D11ContextStateGS {
Com<D3D11GeometryShader> shader;
D3D11GraphicsPipelineBindings bindings;
};
struct D3D11ContextStatePS {
Com<D3D11PixelShader> shader;
D3D11GraphicsPipelineBindings bindings;
};
struct D3D11ContextStateCS {
Com<D3D11ComputeShader> shader;
D3D11ComputePipelineBindings bindings;
};
struct D3D11ContextStateIA {
};
struct D3D11ContextStateOM {
std::array<Com<D3D11RenderTargetView>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> renderTargetViews;
@ -29,6 +87,14 @@ namespace dxvk {
* \brief Context state
*/
struct D3D11ContextState {
D3D11ContextStateCS cs;
D3D11ContextStateDS ds;
D3D11ContextStateGS gs;
D3D11ContextStateHS hs;
D3D11ContextStatePS ps;
D3D11ContextStateVS vs;
D3D11ContextStateIA ia;
D3D11ContextStateOM om;
D3D11ContextStateRS rs;
};

View File

@ -0,0 +1,8 @@
#include "d3d11_device.h"
#include "d3d11_shader.h"
namespace dxvk {
}

56
src/d3d11/d3d11_shader.h Normal file
View File

@ -0,0 +1,56 @@
#pragma once
#include <dxvk_device.h>
#include "d3d11_device_child.h"
#include "d3d11_interfaces.h"
namespace dxvk {
class D3D11Device;
/**
* \brief Common shader interface
*
* Implements methods for all D3D11*Shader
* interfaces and stores the actual shader
* module object.
*/
template<typename Base>
class D3D11Shader : public D3D11DeviceChild<Base> {
public:
D3D11Shader(D3D11Device* device)
: m_device(device) { }
~D3D11Shader() { }
HRESULT QueryInterface(REFIID riid, void** ppvObject) final {
COM_QUERY_IFACE(riid, ppvObject, IUnknown);
COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceChild);
COM_QUERY_IFACE(riid, ppvObject, Base);
Logger::warn("D3D11Shader::QueryInterface: Unknown interface query");
return E_NOINTERFACE;
}
void GetDevice(ID3D11Device **ppDevice) final {
*ppDevice = m_device.ref();
}
private:
Com<D3D11Device> m_device;
};
using D3D11VertexShader = D3D11Shader<ID3D11VertexShader>;
using D3D11HullShader = D3D11Shader<ID3D11HullShader>;
using D3D11DomainShader = D3D11Shader<ID3D11DomainShader>;
using D3D11GeometryShader = D3D11Shader<ID3D11GeometryShader>;
using D3D11PixelShader = D3D11Shader<ID3D11PixelShader>;
using D3D11ComputeShader = D3D11Shader<ID3D11ComputeShader>;
}

View File

@ -29,7 +29,7 @@ namespace dxvk {
void GetDesc(
D3D11_RASTERIZER_DESC* pDesc) final;
Rc<DxvkRasterizerState> GetDXVKStateObject() {
Rc<DxvkRasterizerState> GetDXVKRasterizerState() {
return m_state;
}

View File

@ -5,6 +5,7 @@ d3d11_src = [
'd3d11_enums.cpp',
'd3d11_main.cpp',
'd3d11_present.cpp',
'd3d11_shader.cpp',
'd3d11_state.cpp',
'd3d11_state_rs.cpp',
'd3d11_texture.cpp',