Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngine/interface/PipelineState.h Source File

Diligent Engine API Reference

PipelineState.h
1 /* Copyright 2015-2018 Egor Yusov
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12 *
13 * In no event and under no legal theory, whether in tort (including negligence),
14 * contract, or otherwise, unless required by applicable law (such as deliberate
15 * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16 * liable for any damages, including any direct, indirect, special, incidental,
17 * or consequential damages of any character arising as a result of this License or
18 * out of the use or inability to use the software (including but not limited to damages
19 * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20 * all other commercial damages or losses), even if such Contributor has been advised
21 * of the possibility of such damages.
22 */
23
24 #pragma once
25
28
29 #include "GraphicsTypes.h"
30 #include "Object.h"
31 #include "BlendState.h"
32 #include "RasterizerState.h"
33 #include "DepthStencilState.h"
34 #include "InputLayout.h"
35 #include "ShaderResourceBinding.h"
36 #include "PlatformDefinitions.h"
37
38 namespace Diligent
39 {
40
42
47 enum PRIMITIVE_TOPOLOGY_TYPE : Int32
48 {
50 PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED = 0,
51
53 PRIMITIVE_TOPOLOGY_TYPE_POINT,
54
56 PRIMITIVE_TOPOLOGY_TYPE_LINE,
57
59 PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
60
62 PRIMITIVE_TOPOLOGY_TYPE_PATCH,
63
65 PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES
66 };
67
69
71 struct SampleDesc
72 {
74 Uint32 Count;
75
77 Uint32 Quality;
78
79 SampleDesc() :
80 Count(1),
81 Quality(0)
82 {}
83 };
84
85
87
89 struct GraphicsPipelineDesc
90 {
92 IShader *pVS;
93
95 IShader *pPS;
96
98 IShader *pDS;
99
101 IShader *pHS;
102
104 IShader *pGS;
105
106 //D3D12_STREAM_OUTPUT_DESC StreamOutput;
107
109 BlendStateDesc BlendDesc;
110
115 Uint32 SampleMask;
116
118 RasterizerStateDesc RasterizerDesc;
119
121 DepthStencilStateDesc DepthStencilDesc;
122
124 InputLayoutDesc InputLayout;
125 //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue;
126
128 PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType;
129
131 Uint32 NumRenderTargets;
132
134 TEXTURE_FORMAT RTVFormats[8];
135
137 TEXTURE_FORMAT DSVFormat;
138
140 SampleDesc SmplDesc;
141
143 Uint32 NodeMask;
144
145 //D3D12_CACHED_PIPELINE_STATE CachedPSO;
146 //D3D12_PIPELINE_STATE_FLAGS Flags;
147
148 GraphicsPipelineDesc() :
149 pVS(nullptr),
150 pPS(nullptr),
151 pDS(nullptr),
152 pHS(nullptr),
153 pGS(nullptr),
154 PrimitiveTopologyType(PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE),
155 SampleMask(0xFFFFFFFF),
156 NumRenderTargets(0),
157 NodeMask(0)
158 {
159 for(size_t rt = 0; rt < _countof(RTVFormats); ++rt)
160 RTVFormats[rt] = TEX_FORMAT_UNKNOWN;
161 DSVFormat = TEX_FORMAT_UNKNOWN;
162 };
163 };
164
165
167
169 struct ComputePipelineDesc
170 {
172 IShader *pCS;
173 ComputePipelineDesc() :
174 pCS(nullptr)
175 {}
176 };
177
179 struct PipelineStateDesc : DeviceObjectAttribs
180 {
182 bool IsComputePipeline;
183
185 GraphicsPipelineDesc GraphicsPipeline;
186
188 ComputePipelineDesc ComputePipeline;
189
191
194 Uint32 SRBAllocationGranularity;
195
196 PipelineStateDesc() :
197 IsComputePipeline(false),
198 SRBAllocationGranularity(1)
199 {}
200 };
201
202 // {06084AE5-6A71-4FE8-84B9-395DD489A28C}
203 static constexpr INTERFACE_ID IID_PipelineState =
204 { 0x6084ae5, 0x6a71, 0x4fe8, { 0x84, 0xb9, 0x39, 0x5d, 0xd4, 0x89, 0xa2, 0x8c } };
205
209 class IPipelineState : public IDeviceObject
210 {
211 public:
213 virtual void QueryInterface( const INTERFACE_ID &IID, IObject **ppInterface ) = 0;
214
216 virtual const PipelineStateDesc& GetDesc()const = 0;
217
219
225 virtual void BindShaderResources( IResourceMapping *pResourceMapping, Uint32 Flags ) = 0;
226
228
231 virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding ) = 0;
232 };
233
234 }
Diligent::GraphicsPipelineDesc::DepthStencilDesc
DepthStencilStateDesc DepthStencilDesc
Depth-stencil state description.
Definition: PipelineState.h:121
Diligent::GraphicsPipelineDesc::pVS
IShader * pVS
Vertex shader to be used with the pipeline.
Definition: PipelineState.h:92
Diligent::TEXTURE_FORMAT
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Diligent::IShader
Shader interface.
Definition: Shader.h:288
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Diligent::TEX_FORMAT_UNKNOWN
Unknown format.
Definition: GraphicsTypes.h:247
Diligent::PRIMITIVE_TOPOLOGY_TYPE_LINE
Interpret the input primitive as a line.
Definition: PipelineState.h:56
Diligent::GraphicsPipelineDesc::PrimitiveTopologyType
PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType
Primitive topology type.
Definition: PipelineState.h:128
Diligent::GraphicsPipelineDesc::SampleMask
Uint32 SampleMask
32-bit sample mask that determines which samples get updated in all the active render targets...
Definition: PipelineState.h:115
Diligent::IPipelineState::CreateShaderResourceBinding
virtual void CreateShaderResourceBinding(IShaderResourceBinding **ppShaderResourceBinding)=0
Creates a shader resource binding object.
Diligent
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Diligent::PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE
Interpret the input primitive as a triangle.
Definition: PipelineState.h:59
Diligent::GraphicsPipelineDesc
Graphics pipeline state description.
Definition: PipelineState.h:89
Diligent::SampleDesc
Sample description.
Definition: PipelineState.h:71
Diligent::IResourceMapping
Resouce mapping.
Definition: ResourceMapping.h:80
Diligent::IShaderResourceBinding
Shader resource binding interface.
Definition: ShaderResourceBinding.h:40
Diligent::GraphicsPipelineDesc::pHS
IShader * pHS
Hull shader to be used with the pipeline.
Definition: PipelineState.h:101
Diligent::GraphicsPipelineDesc::pGS
IShader * pGS
Geometry shader to be used with the pipeline.
Definition: PipelineState.h:104
Diligent::PRIMITIVE_TOPOLOGY_TYPE_PATCH
Interpret the input primitive as a control point patch.
Definition: PipelineState.h:62
Diligent::GraphicsPipelineDesc::RTVFormats
TEXTURE_FORMAT RTVFormats[8]
Render target formats.
Definition: PipelineState.h:134
Diligent::SampleDesc::Quality
Uint32 Quality
Quality.
Definition: PipelineState.h:77
Diligent::PRIMITIVE_TOPOLOGY_TYPE_POINT
Interpret the input primitive as a point.
Definition: PipelineState.h:53
Diligent::BlendStateDesc
Blend state description.
Definition: BlendState.h:351
Diligent::GraphicsPipelineDesc::pPS
IShader * pPS
Pixel shader to be used with the pipeline.
Definition: PipelineState.h:95
Diligent::InputLayoutDesc
Layout description.
Definition: InputLayout.h:107
Diligent::IPipelineState::BindShaderResources
virtual void BindShaderResources(IResourceMapping *pResourceMapping, Uint32 Flags)=0
Binds resources for all shaders in the pipeline state.
Diligent::GraphicsPipelineDesc::NodeMask
Uint32 NodeMask
Node mask.
Definition: PipelineState.h:143
Diligent::PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES
Total number of topology types.
Definition: PipelineState.h:65
Diligent::RasterizerStateDesc
Rasterizer state description.
Definition: RasterizerState.h:90
Diligent::SampleDesc::Count
Uint32 Count
Sample count.
Definition: PipelineState.h:74
Diligent::GraphicsPipelineDesc::RasterizerDesc
RasterizerStateDesc RasterizerDesc
Rasterizer state description.
Definition: PipelineState.h:118
Diligent::GraphicsPipelineDesc::pDS
IShader * pDS
Domain shader to be used with the pipeline.
Definition: PipelineState.h:98
Diligent::IPipelineState
Definition: PipelineState.h:209
Diligent::IPipelineState::QueryInterface
virtual void QueryInterface(const INTERFACE_ID &IID, IObject **ppInterface)=0
Queries the specific interface, see IObject::QueryInterface() for details.
Diligent::DepthStencilStateDesc
Depth stencil state description.
Definition: DepthStencilState.h:145
Diligent::PipelineStateDesc::ComputePipeline
ComputePipelineDesc ComputePipeline
Compute pipeline state description. This memeber is ignored if IsComputePipeline == False...
Definition: PipelineState.h:188
Diligent::GraphicsPipelineDesc::InputLayout
InputLayoutDesc InputLayout
Input layout.
Definition: PipelineState.h:124
Diligent::DeviceObjectAttribs
Describes common device object attributes.
Definition: GraphicsTypes.h:900
Diligent::PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED
Topology is not defined.
Definition: PipelineState.h:50
Diligent::GraphicsPipelineDesc::SmplDesc
SampleDesc SmplDesc
Multisampling parameters.
Definition: PipelineState.h:140
Diligent::ComputePipelineDesc
Compute pipeline state description.
Definition: PipelineState.h:169
Diligent::GraphicsPipelineDesc::DSVFormat
TEXTURE_FORMAT DSVFormat
Depth-stencil format.
Definition: PipelineState.h:137
Diligent::IPipelineState::GetDesc
virtual const PipelineStateDesc & GetDesc() const =0
Returns the blend state description used to create the object.
Diligent::PipelineStateDesc::IsComputePipeline
bool IsComputePipeline
Flag indicating if pipeline state is a compute pipeline state.
Definition: PipelineState.h:182
Diligent::PipelineStateDesc::GraphicsPipeline
GraphicsPipelineDesc GraphicsPipeline
Graphics pipeline state description. This memeber is ignored if IsComputePipeline == True...
Definition: PipelineState.h:185
Diligent::PipelineStateDesc::SRBAllocationGranularity
Uint32 SRBAllocationGranularity
Shader resource binding allocation granularity.
Definition: PipelineState.h:194
Diligent::GraphicsPipelineDesc::BlendDesc
BlendStateDesc BlendDesc
Blend state description.
Definition: PipelineState.h:109
Diligent::PipelineStateDesc
Pipeline state description.
Definition: PipelineState.h:179
Diligent::PRIMITIVE_TOPOLOGY_TYPE
PRIMITIVE_TOPOLOGY_TYPE
Primitive topology type.
Definition: PipelineState.h:47
Diligent::GraphicsPipelineDesc::NumRenderTargets
Uint32 NumRenderTargets
Number of render targets in the RTVFormats member.
Definition: PipelineState.h:131
Diligent::ComputePipelineDesc::pCS
IShader * pCS
Compute shader to be used with the pipeline.
Definition: PipelineState.h:172