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 
48 {
51 
54 
57 
60 
63 
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 
90 {
93 
96 
99 
102 
105 
106  //D3D12_STREAM_OUTPUT_DESC StreamOutput;
107 
110 
115  Uint32 SampleMask;
116 
119 
122 
125  //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue;
126 
129 
132 
135 
138 
141 
143  Uint32 NodeMask;
144 
145  //D3D12_CACHED_PIPELINE_STATE CachedPSO;
146  //D3D12_PIPELINE_STATE_FLAGS Flags;
147 
149  pVS(nullptr),
150  pPS(nullptr),
151  pDS(nullptr),
152  pHS(nullptr),
153  pGS(nullptr),
155  SampleMask(0xFFFFFFFF),
156  NumRenderTargets(0),
157  NodeMask(0)
158  {
159  for(size_t rt = 0; rt < _countof(RTVFormats); ++rt)
162  };
163 };
164 
165 
167 
170 {
174  pCS(nullptr)
175  {}
176 };
177 
180 {
183 
186 
189 
191 
195 
196  PipelineStateDesc() :
197  IsComputePipeline(false),
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 
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 }
DepthStencilStateDesc DepthStencilDesc
Depth-stencil state description.
Definition: PipelineState.h:121
IShader * pVS
Vertex shader to be used with the pipeline.
Definition: PipelineState.h:92
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Shader interface.
Definition: Shader.h:288
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Unknown format.
Definition: GraphicsTypes.h:247
Interpret the input primitive as a line.
Definition: PipelineState.h:56
PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType
Primitive topology type.
Definition: PipelineState.h:128
Uint32 SampleMask
32-bit sample mask that determines which samples get updated in all the active render targets...
Definition: PipelineState.h:115
virtual void CreateShaderResourceBinding(IShaderResourceBinding **ppShaderResourceBinding)=0
Creates a shader resource binding object.
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Interpret the input primitive as a triangle.
Definition: PipelineState.h:59
Graphics pipeline state description.
Definition: PipelineState.h:89
Sample description.
Definition: PipelineState.h:71
Resouce mapping.
Definition: ResourceMapping.h:80
Shader resource binding interface.
Definition: ShaderResourceBinding.h:40
IShader * pHS
Hull shader to be used with the pipeline.
Definition: PipelineState.h:101
IShader * pGS
Geometry shader to be used with the pipeline.
Definition: PipelineState.h:104
Interpret the input primitive as a control point patch.
Definition: PipelineState.h:62
TEXTURE_FORMAT RTVFormats[8]
Render target formats.
Definition: PipelineState.h:134
Uint32 Quality
Quality.
Definition: PipelineState.h:77
Interpret the input primitive as a point.
Definition: PipelineState.h:53
Blend state description.
Definition: BlendState.h:351
IShader * pPS
Pixel shader to be used with the pipeline.
Definition: PipelineState.h:95
Layout description.
Definition: InputLayout.h:107
virtual void BindShaderResources(IResourceMapping *pResourceMapping, Uint32 Flags)=0
Binds resources for all shaders in the pipeline state.
Uint32 NodeMask
Node mask.
Definition: PipelineState.h:143
Total number of topology types.
Definition: PipelineState.h:65
Rasterizer state description.
Definition: RasterizerState.h:90
Uint32 Count
Sample count.
Definition: PipelineState.h:74
RasterizerStateDesc RasterizerDesc
Rasterizer state description.
Definition: PipelineState.h:118
IShader * pDS
Domain shader to be used with the pipeline.
Definition: PipelineState.h:98
Definition: PipelineState.h:209
virtual void QueryInterface(const INTERFACE_ID &IID, IObject **ppInterface)=0
Queries the specific interface, see IObject::QueryInterface() for details.
Depth stencil state description.
Definition: DepthStencilState.h:145
ComputePipelineDesc ComputePipeline
Compute pipeline state description. This memeber is ignored if IsComputePipeline == False...
Definition: PipelineState.h:188
InputLayoutDesc InputLayout
Input layout.
Definition: PipelineState.h:124
Describes common device object attributes.
Definition: GraphicsTypes.h:900
Topology is not defined.
Definition: PipelineState.h:50
SampleDesc SmplDesc
Multisampling parameters.
Definition: PipelineState.h:140
Compute pipeline state description.
Definition: PipelineState.h:169
TEXTURE_FORMAT DSVFormat
Depth-stencil format.
Definition: PipelineState.h:137
virtual const PipelineStateDesc & GetDesc() const =0
Returns the blend state description used to create the object.
bool IsComputePipeline
Flag indicating if pipeline state is a compute pipeline state.
Definition: PipelineState.h:182
GraphicsPipelineDesc GraphicsPipeline
Graphics pipeline state description. This memeber is ignored if IsComputePipeline == True...
Definition: PipelineState.h:185
Uint32 SRBAllocationGranularity
Shader resource binding allocation granularity.
Definition: PipelineState.h:194
BlendStateDesc BlendDesc
Blend state description.
Definition: PipelineState.h:109
Pipeline state description.
Definition: PipelineState.h:179
PRIMITIVE_TOPOLOGY_TYPE
Primitive topology type.
Definition: PipelineState.h:47
Uint32 NumRenderTargets
Number of render targets in the RTVFormats member.
Definition: PipelineState.h:131
IShader * pCS
Compute shader to be used with the pipeline.
Definition: PipelineState.h:172