2017-11-29 20:19:40 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
2017-12-06 14:16:14 +01:00
|
|
|
#include "d3d11_buffer.h"
|
2017-12-07 12:45:02 +01:00
|
|
|
#include "d3d11_input_layout.h"
|
2017-12-09 21:17:26 +01:00
|
|
|
#include "d3d11_sampler.h"
|
2017-12-06 14:16:14 +01:00
|
|
|
#include "d3d11_shader.h"
|
2017-12-06 12:11:59 +01:00
|
|
|
#include "d3d11_state.h"
|
2018-01-11 12:23:55 +01:00
|
|
|
#include "d3d11_uav.h"
|
2017-12-04 13:39:37 +01:00
|
|
|
#include "d3d11_view.h"
|
2017-11-29 20:19:40 +01:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2017-12-08 19:39:33 +01:00
|
|
|
using D3D11ConstantBufferBindings = std::array<
|
|
|
|
Com<D3D11Buffer>, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT>;
|
2017-12-06 14:16:14 +01:00
|
|
|
|
2017-12-10 01:56:07 +01:00
|
|
|
|
2017-12-09 21:17:26 +01:00
|
|
|
using D3D11SamplerBindings = std::array<
|
|
|
|
Com<D3D11SamplerState>, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT>;
|
|
|
|
|
|
|
|
|
2017-12-10 01:56:07 +01:00
|
|
|
using D3D11ShaderResourceBindings = std::array<
|
|
|
|
Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT>;
|
|
|
|
|
2017-12-27 01:36:45 +01:00
|
|
|
|
|
|
|
using D3D11UnorderedAccessBindings = std::array<
|
|
|
|
Com<D3D11UnorderedAccessView>, D3D11_1_UAV_SLOT_COUNT>;
|
|
|
|
|
2017-12-10 01:56:07 +01:00
|
|
|
|
2017-12-06 14:16:14 +01:00
|
|
|
struct D3D11ContextStateVS {
|
|
|
|
Com<D3D11VertexShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11ContextStateHS {
|
|
|
|
Com<D3D11HullShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11ContextStateDS {
|
|
|
|
Com<D3D11DomainShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11ContextStateGS {
|
|
|
|
Com<D3D11GeometryShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11ContextStatePS {
|
|
|
|
Com<D3D11PixelShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2018-01-12 15:38:07 +01:00
|
|
|
D3D11UnorderedAccessBindings unorderedAccessViews;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11ContextStateCS {
|
2017-12-09 21:17:26 +01:00
|
|
|
Com<D3D11ComputeShader> shader;
|
2017-12-08 19:39:33 +01:00
|
|
|
D3D11ConstantBufferBindings constantBuffers;
|
2017-12-09 21:17:26 +01:00
|
|
|
D3D11SamplerBindings samplers;
|
2017-12-10 01:56:07 +01:00
|
|
|
D3D11ShaderResourceBindings shaderResources;
|
2017-12-27 01:36:45 +01:00
|
|
|
D3D11UnorderedAccessBindings unorderedAccessViews;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-07 14:03:15 +01:00
|
|
|
struct D3D11VertexBufferBinding {
|
|
|
|
Com<D3D11Buffer> buffer = nullptr;
|
|
|
|
UINT offset = 0;
|
|
|
|
UINT stride = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D3D11IndexBufferBinding {
|
|
|
|
Com<D3D11Buffer> buffer = nullptr;
|
|
|
|
UINT offset = 0;
|
|
|
|
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-06 14:16:14 +01:00
|
|
|
struct D3D11ContextStateIA {
|
2017-12-07 12:45:02 +01:00
|
|
|
Com<D3D11InputLayout> inputLayout;
|
2017-12-06 18:54:01 +01:00
|
|
|
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
2017-12-07 14:03:15 +01:00
|
|
|
|
|
|
|
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers;
|
|
|
|
D3D11IndexBufferBinding indexBuffer;
|
2017-12-06 14:16:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-04 13:39:37 +01:00
|
|
|
struct D3D11ContextStateOM {
|
2017-12-06 12:11:59 +01:00
|
|
|
std::array<Com<D3D11RenderTargetView>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> renderTargetViews;
|
2017-12-09 03:53:42 +01:00
|
|
|
Com<D3D11DepthStencilView> depthStencilView;
|
2017-12-11 14:11:18 +01:00
|
|
|
|
|
|
|
Com<D3D11BlendState> cbState = nullptr;
|
|
|
|
Com<D3D11DepthStencilState> dsState = nullptr;
|
|
|
|
|
|
|
|
FLOAT blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
|
|
|
UINT sampleMask = 0xFFFFFFFFu;
|
|
|
|
UINT stencilRef = 0u;
|
2017-12-04 13:39:37 +01:00
|
|
|
};
|
|
|
|
|
2017-12-05 12:59:35 +01:00
|
|
|
|
2017-12-06 12:11:59 +01:00
|
|
|
struct D3D11ContextStateRS {
|
|
|
|
uint32_t numViewports = 0;
|
|
|
|
uint32_t numScissors = 0;
|
|
|
|
|
|
|
|
std::array<D3D11_VIEWPORT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports;
|
|
|
|
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors;
|
|
|
|
|
|
|
|
Com<D3D11RasterizerState> state;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-29 20:19:40 +01:00
|
|
|
/**
|
|
|
|
* \brief Context state
|
|
|
|
*/
|
|
|
|
struct D3D11ContextState {
|
2017-12-06 14:16:14 +01:00
|
|
|
D3D11ContextStateCS cs;
|
|
|
|
D3D11ContextStateDS ds;
|
|
|
|
D3D11ContextStateGS gs;
|
|
|
|
D3D11ContextStateHS hs;
|
|
|
|
D3D11ContextStatePS ps;
|
|
|
|
D3D11ContextStateVS vs;
|
|
|
|
|
|
|
|
D3D11ContextStateIA ia;
|
2017-12-04 13:39:37 +01:00
|
|
|
D3D11ContextStateOM om;
|
2017-12-06 12:11:59 +01:00
|
|
|
D3D11ContextStateRS rs;
|
2017-11-29 20:19:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|