Diligent Engine API Reference
DepthStencilState.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 
42 enum STENCIL_OP : Int32
43 {
46 
50 
54 
58 
62 
66 
70 
75 
80 
83 };
84 
86 
93 {
96 
99 
102 
106 
108 
121  {}
122 
124 
129  bool operator == (const StencilOpDesc& rhs)const
130  {
131  return StencilFailOp == rhs.StencilFailOp &&
133  StencilPassOp == rhs.StencilPassOp &&
134  StencilFunc == rhs.StencilFunc;
135  }
136 };
137 
139 
146 {
151 
154 
158 
161 
164 
167 
170 
173 
175 
188  DepthStencilStateDesc(Bool _DepthEnable = True,
189  Bool _DepthWriteEnable = True,
191  Bool _StencilEnable = False,
192  Uint8 _StencilReadMask = 0xFF,
193  Uint8 _StencilWriteMask = 0xFF) :
194  DepthEnable ( _DepthEnable ),
195  DepthWriteEnable( _DepthWriteEnable ),
196  DepthFunc ( _DepthFunc ),
197  StencilEnable ( _StencilEnable ),
198  StencilReadMask ( _StencilReadMask ),
199  StencilWriteMask( _StencilWriteMask )
200  {}
201 
203 
208  bool operator == (const DepthStencilStateDesc& rhs)const
209  {
210  return DepthEnable == rhs.DepthEnable &&
212  DepthFunc == rhs.DepthFunc &&
213  StencilEnable == rhs.StencilEnable &&
216  FrontFace == rhs.FrontFace &&
217  BackFace == rhs.BackFace;
218  }
219 };
220 
221 }
STENCIL_OP StencilPassOp
The stencil operation to perform when stencil testing and depth testing both pass.
Definition: DepthStencilState.h:101
COMPARISON_FUNCTION StencilFunc
A function that compares stencil data against existing stencil data. See Diligent::COMPARISON_FUNCTIO...
Definition: DepthStencilState.h:105
Comparison always passes. Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAY...
Definition: GraphicsTypes.h:882
STENCIL_OP
Stencil operation.
Definition: DepthStencilState.h:42
Uint8 StencilWriteMask
Identify which bits of the depth-stencil buffer are accessed when writing stencil data...
Definition: DepthStencilState.h:166
Bool DepthEnable
Enable depth-stencil operations. When it is set to False, depth test always passes, depth writes are disabled, and no stencil operations are performed.
Definition: DepthStencilState.h:150
Keep the existing stencil data. Direct3D counterpart: D3D11_STENCIL_OP_KEEP/D3D12_STENCIL_OP_KEEP. OpenGL counterpart: GL_KEEP.
Definition: DepthStencilState.h:49
Uint8 StencilReadMask
Identify which bits of the depth-stencil buffer are accessed when reading stencil data...
Definition: DepthStencilState.h:163
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Set the stencil data to the reference value set by calling IDeviceContext::SetStencilRef(). Direct3D counterpart: D3D11_STENCIL_OP_REPLACE/D3D12_STENCIL_OP_REPLACE. OpenGL counterpart: GL_REPLACE.
Definition: DepthStencilState.h:57
Decrement the current stencil value, and clamp to 0. Direct3D counterpart: D3D11_STENCIL_OP_DECR_SAT...
Definition: DepthStencilState.h:65
DepthStencilStateDesc(Bool _DepthEnable=True, Bool _DepthWriteEnable=True, COMPARISON_FUNCTION _DepthFunc=COMPARISON_FUNC_LESS, Bool _StencilEnable=False, Uint8 _StencilReadMask=0xFF, Uint8 _StencilWriteMask=0xFF)
Initializes the structure members.
Definition: DepthStencilState.h:188
StencilOpDesc FrontFace
Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:169
STENCIL_OP StencilFailOp
The stencil operation to perform when stencil testing fails.
Definition: DepthStencilState.h:95
Decrement the current stencil value, and wrap the value to the maximum representable unsigned value w...
Definition: DepthStencilState.h:79
Comparison passes if the source data is less than the destination data. Direct3D counterpart: D3D11_...
Definition: GraphicsTypes.h:858
Describes stencil operations that are performed based on the results of depth test.
Definition: DepthStencilState.h:92
Set the stencil data to 0. Direct3D counterpart: D3D11_STENCIL_OP_ZERO/D3D12_STENCIL_OP_ZERO. OpenGL counterpart: GL_ZERO.
Definition: DepthStencilState.h:53
bool operator==(const DepthStencilStateDesc &rhs) const
Tests if two structures are equivalent.
Definition: DepthStencilState.h:208
STENCIL_OP StencilDepthFailOp
The stencil operation to perform when stencil testing passes and depth testing fails.
Definition: DepthStencilState.h:98
Bool DepthWriteEnable
Enable or disable writes to a depth buffer.
Definition: DepthStencilState.h:153
StencilOpDesc BackFace
Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:172
Bitwise invert the current stencil buffer value. Direct3D counterpart: D3D11_STENCIL_OP_INVERT/D3D12...
Definition: DepthStencilState.h:69
Helper value that stores the total number of stencil operations in the enumeration.
Definition: DepthStencilState.h:82
Bool StencilEnable
Enable stencil opertaions.
Definition: DepthStencilState.h:160
Depth stencil state description.
Definition: DepthStencilState.h:145
Increment the current stencil value, and wrap the value to zero when incrementing the maximum represe...
Definition: DepthStencilState.h:74
Undefined operation.
Definition: DepthStencilState.h:45
bool operator==(const StencilOpDesc &rhs) const
Tests if two structures are equivalent.
Definition: DepthStencilState.h:129
Increment the current stencil value, and clamp to the maximum representable unsigned value...
Definition: DepthStencilState.h:61
COMPARISON_FUNCTION
Comparison function.
Definition: GraphicsTypes.h:847
COMPARISON_FUNCTION DepthFunc
A function that compares depth data against existing depth data. See Diligent::COMPARISON_FUNCTION fo...
Definition: DepthStencilState.h:157
StencilOpDesc()
Initializes the structure members with default values.
Definition: DepthStencilState.h:116