Diligent Engine API Reference
BlendState.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 "BasicTypes.h"
30 
31 namespace Diligent
32 {
33 
35 
43 enum BLEND_FACTOR : Int8
44 {
47 
51 
55 
59 
63 
67 
71 
75 
79 
83 
87 
92 
96 
100 
104 
108 
112 
116 
119 };
120 
122 
130 enum BLEND_OPERATION : Int8
131 {
134 
138 
142 
146 
150 
154 
157 };
158 
160 
163 enum COLOR_MASK : Int32
164 {
167 
170 
173 
176 
179 };
180 
181 
183 
189 enum LOGIC_OPERATION : Int8
190 {
194 
198 
202 
206 
210 
214 
218 
222 
226 
230 
234 
238 
242 
246 
250 
254 
257 };
258 
260 
264 {
267 
270 
273 
276 
280 
284 
288 
292 
295 
298 
300 
314  BlendEnable ( False ),
315  LogicOperationEnable(False),
324  {}
325 
326 
328 
333  bool operator == (const RenderTargetBlendDesc& rhs)const
334  {
335  return BlendEnable == rhs.BlendEnable &&
337  SrcBlend == rhs.SrcBlend &&
338  DestBlend == rhs.DestBlend &&
339  BlendOp == rhs.BlendOp &&
340  SrcBlendAlpha == rhs.SrcBlendAlpha &&
342  BlendOpAlpha == rhs.BlendOpAlpha &&
343  LogicOp == rhs.LogicOp &&
345  }
346 };
347 
349 
352 {
356 
360 
362  static constexpr int MaxRenderTargets = 8;
363 
367 
369 
378  AlphaToCoverageEnable(False),
380  {
381  }
382 
384 
393  bool operator == (const BlendStateDesc& RHS)const
394  {
395  bool bRTsEqual = true;
396  for( int i = 0; i < MaxRenderTargets; ++i )
397  if( !(RenderTargets[i] == RHS.RenderTargets[i]) )
398  {
399  bRTsEqual = false;
400  break;
401  }
402 
403  return bRTsEqual &&
406  }
407 };
408 
409 }
Perform a logical OR and reverse operation on the render target. Direct3D12 counterpart: D3D12_LOGIC...
Definition: BlendState.h:249
BLEND_OPERATION
Blending operation.
Definition: BlendState.h:130
Undefined blend factor.
Definition: BlendState.h:46
Perform a logical OR operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_OR.
Definition: BlendState.h:225
BLEND_OPERATION BlendOp
Defines how to combine the source and destination RGB values after applying the SrcBlend and DestBlen...
Definition: BlendState.h:279
COLOR_MASK
Color component write flags.
Definition: BlendState.h:163
Helper value that stores the total number of blend operations in the enumeration. ...
Definition: BlendState.h:156
The blend factor is one. Direct3D counterpart: D3D11_BLEND_ONE/D3D12_BLEND_ONE. OpenGL counterpart: ...
Definition: BlendState.h:54
BlendStateDesc()
Constructor initializes structure members with default values.
Definition: BlendState.h:377
Allow data to be stored in the blue component.
Definition: BlendState.h:172
Perform a logical equal operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_EQUIV...
Definition: BlendState.h:237
Helper value that stores the total number of blend factors in the enumeration.
Definition: BlendState.h:118
The blend factor is 1-A, where A is the second alpha data output from a pixel shader. Direct3D counterpart: D3D11_BLEND_INV_SRC1_ALPHA/D3D12_BLEND_INV_SRC1_ALPHA. OpenGL counterpart: GL_ONE_MINUS_SRC1_ALPHA.
Definition: BlendState.h:115
Undefined blend operation.
Definition: BlendState.h:133
Bool AlphaToCoverageEnable
Specifies whether to use alpha-to-coverage as a multisampling technique when setting a pixel to a ren...
Definition: BlendState.h:355
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Add source and destination color components. Direct3D counterpart: D3D11_BLEND_OP_ADD/D3D12_BLEND_OP...
Definition: BlendState.h:137
RenderTargetBlendDesc()
Constructor initializes structure members with default values.
Definition: BlendState.h:313
The blend factor is the constant blend factor set with IDeviceContext::SetBlendFactors(). Direct3D counterpart: D3D11_BLEND_BLEND_FACTOR/D3D12_BLEND_BLEND_FACTOR. OpenGL counterpart: GL_CONSTANT_COLOR.
Definition: BlendState.h:95
Perform a logical AND operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_AND.
Definition: BlendState.h:217
Subtract source color components from destination color components. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:145
LOGIC_OPERATION LogicOp
Defines logical operation for the render target.
Definition: BlendState.h:294
Copy the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_COPY.
Definition: BlendState.h:201
Allow data to be stored in all components.
Definition: BlendState.h:178
The blend factor is 1-RGB, where RGB is the data from a render target. Direct3D counterpart: D3D11_B...
Definition: BlendState.h:86
The blend factor is 1-A, where A is alpha data from a render target. Direct3D counterpart: D3D11_BLE...
Definition: BlendState.h:78
Perform a logical NOR operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_NOR.
Definition: BlendState.h:229
Bool LogicOperationEnable
Enable or disable a logical operation for this render target.
Definition: BlendState.h:269
Allow data to be stored in the red component.
Definition: BlendState.h:166
Perform a logical OR and invert operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_...
Definition: BlendState.h:253
BLEND_FACTOR DestBlendAlpha
Specifies the blend factor to apply to the alpha value in the render target. Blend factors that end i...
Definition: BlendState.h:287
Perform a logical AND and invert operation on the render target. Direct3D12 counterpart: D3D12_LOGIC...
Definition: BlendState.h:245
The blend factor is alpha (A) data from a pixel shader. Direct3D counterpart: D3D11_BLEND_SRC_ALPHA/...
Definition: BlendState.h:66
Blend state description.
Definition: BlendState.h:351
The blend factor is the second alpha (A) data output from a pixel shader. Direct3D counterpart: D3D1...
Definition: BlendState.h:111
bool operator==(const BlendStateDesc &RHS) const
Comparison operator tests if two structures are equivalent.
Definition: BlendState.h:393
BLEND_FACTOR SrcBlend
Specifies the blend factor to apply to the RGB value output from the pixel shader.
Definition: BlendState.h:272
Subtract destination color components from source color components. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:141
Compute the minimum of source and destination color components. Direct3D counterpart: D3D11_BLEND_OP...
Definition: BlendState.h:149
Uint32 RenderTargetWriteMask
Render target write mask.
Definition: BlendState.h:297
No operation is performed on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_NOOP.
Definition: BlendState.h:209
Bool IndependentBlendEnable
Specifies whether to enable independent blending in simultaneous render targets. If set to False...
Definition: BlendState.h:359
The blend factor is 1-RGB, where RGB is the second RGB data output from a pixel shader. Direct3D counterpart: D3D11_BLEND_INV_SRC1_COLOR/D3D12_BLEND_INV_SRC1_COLOR. OpenGL counterpart: GL_ONE_MINUS_SRC1_COLOR.
Definition: BlendState.h:107
bool operator==(const RenderTargetBlendDesc &rhs) const
Comparison operator tests if two structures are equivalent.
Definition: BlendState.h:333
The blend factor is 1-RGB, where RGB is the data from a pixel shader. Direct3D counterpart: D3D11_BL...
Definition: BlendState.h:62
Describes a blend state for a single render target.
Definition: BlendState.h:263
Allow data to be stored in the green component.
Definition: BlendState.h:169
Perform a logical XOR operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_XOR.
Definition: BlendState.h:233
BLEND_OPERATION BlendOpAlpha
Defines how to combine the source and destination alpha values after applying the SrcBlendAlpha and D...
Definition: BlendState.h:291
BLEND_FACTOR SrcBlendAlpha
Specifies the blend factor to apply to the alpha value output from the pixel shader. Blend factors that end in _COLOR are not allowed.
Definition: BlendState.h:283
The blend factor is the second RGB data output from a pixel shader. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:103
static constexpr int MaxRenderTargets
Constant member defining the maximum number of render targets.
Definition: BlendState.h:362
Compute the maximum of source and destination color components. Direct3D counterpart: D3D11_BLEND_OP...
Definition: BlendState.h:153
Perform a logical AND and reverse operation on the render target. Direct3D12 counterpart: D3D12_LOGI...
Definition: BlendState.h:241
Helper value that stores the total number of logical operations in the enumeration.
Definition: BlendState.h:256
BLEND_FACTOR DestBlend
Specifies the blend factor to apply to the RGB value in the render target.
Definition: BlendState.h:275
The blend factor is (f,f,f,1), where f = min(As, 1-Ad), As is alpha data from a pixel shader...
Definition: BlendState.h:91
The blend factor is RGB data from a render target. Direct3D counterpart: D3D11_BLEND_DEST_COLOR/D3D1...
Definition: BlendState.h:82
The blend factor is zero. Direct3D counterpart: D3D11_BLEND_ZERO/D3D12_BLEND_ZERO. OpenGL counterpart: GL_ZERO.
Definition: BlendState.h:50
Allow data to be stored in the alpha component.
Definition: BlendState.h:175
The blend factor is alpha (A) data from a render target. Direct3D counterpart: D3D11_BLEND_DEST_ALPH...
Definition: BlendState.h:74
BLEND_FACTOR
Blend factors.
Definition: BlendState.h:43
The blend factor is one minus constant blend factor set with IDeviceContext::SetBlendFactors(). Direct3D counterpart: D3D11_BLEND_INV_BLEND_FACTOR/D3D12_BLEND_INV_BLEND_FACTOR. OpenGL counterpart: GL_ONE_MINUS_CONSTANT_COLOR.
Definition: BlendState.h:99
The blend factor is 1-A, where A is alpha data from a pixel shader. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:70
RenderTargetBlendDesc RenderTargets[MaxRenderTargets]
An array of RenderTargetBlendDesc structures that describe the blend states for render targets...
Definition: BlendState.h:366
Perform a logical NAND operation on the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_NAND.
Definition: BlendState.h:221
Clear the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_CLEAR.
Definition: BlendState.h:193
Bool BlendEnable
Enable or disable blending for this render target.
Definition: BlendState.h:266
The blend factor is RGB data from a pixel shader. Direct3D counterpart: D3D11_BLEND_SRC_COLOR/D3D12_...
Definition: BlendState.h:58
LOGIC_OPERATION
Logic operation.
Definition: BlendState.h:189
Set the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_SET.
Definition: BlendState.h:197
Invert the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_INVERT.
Definition: BlendState.h:213
Perform an inverted-copy of the render target. Direct3D12 counterpart: D3D12_LOGIC_OP_COPY_INVERTED...
Definition: BlendState.h:205