Diligent Engine  v.2.4.g
CommonlyUsedStates.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 #include "../../GraphicsEngine/interface/GraphicsTypes.h"
34 #include "../../GraphicsEngine/interface/DepthStencilState.h"
35 #include "../../GraphicsEngine/interface/BlendState.h"
36 #include "../../GraphicsEngine/interface/RasterizerState.h"
37 #include "../../GraphicsEngine/interface/Sampler.h"
38 
40 
41 // clang-format off
42 
43 // Common depth-stencil states
44 static const DepthStencilStateDesc DSS_Default{};
45 
46 static const DepthStencilStateDesc DSS_DisableDepth
47 {
48  False, // DepthEnable
49  False // DepthWriteEnable
50 };
51 
52 
53 // Common rasterizer states
54 static const RasterizerStateDesc RS_Default{};
55 
56 static const RasterizerStateDesc RS_SolidFillNoCull
57 {
60 };
61 
62 static const RasterizerStateDesc RS_WireFillNoCull
63 {
66 };
67 
68 
69 // Blend states
70 static const BlendStateDesc BS_Default{};
71 
72 static const BlendStateDesc BS_AlphaBlend =
73 {
74  False, // AlphaToCoverageEnable
75  False, // IndependentBlendEnable
76  RenderTargetBlendDesc // Render Target 0
77  {
78  True, // BlendEnable
79  False, // LogicOperationEnable
80  BLEND_FACTOR_SRC_ALPHA, // SrcBlend
81  BLEND_FACTOR_INV_SRC_ALPHA, // DestBlend
82  BLEND_OPERATION_ADD, // BlendOp
83  BLEND_FACTOR_SRC_ALPHA, // SrcBlendAlpha
84  BLEND_FACTOR_INV_SRC_ALPHA, // DestBlendAlpha
85  BLEND_OPERATION_ADD // BlendOpAlpha
86  }
87 };
88 
89 
90 // Common sampler states
91 static const SamplerDesc Sam_LinearClamp
92 {
99 };
100 
101 static const SamplerDesc Sam_PointClamp
102 {
109 };
110 
111 static const SamplerDesc Sam_LinearMirror
112 {
119 };
120 
121 static const SamplerDesc Sam_PointWrap
122 {
129 };
130 
131 static const SamplerDesc Sam_LinearWrap
132 {
139 };
140 
141 static const SamplerDesc Sam_ComparsionLinearClamp
142 {
152 };
153 
154 static const SamplerDesc Sam_Aniso2xClamp
155 {
162  0.f, // MipLODBias
163  2 // MaxAnisotropy
164 };
165 
166 static const SamplerDesc Sam_Aniso4xClamp
167 {
174  0.f, // MipLODBias
175  4 // MaxAnisotropy
176 };
177 
178 static const SamplerDesc Sam_Aniso8xClamp
179 {
186  0.f, // MipLODBias
187  8 // MaxAnisotropy
188 };
189 
190 static const SamplerDesc Sam_Aniso16xClamp
191 {
198  0.f, // MipLODBias
199  16 // MaxAnisotropy
200 };
201 
202 static const SamplerDesc Sam_Aniso4xWrap
203 {
210  0.f, // MipLODBias
211  4 // MaxAnisotropy
212 };
213 
214 static const SamplerDesc Sam_Aniso8xWrap
215 {
222  0.f, // MipLODBias
223  8 // MaxAnisotropy
224 };
225 
226 DILIGENT_END_NAMESPACE // namespace Diligent
Diligent::FILL_MODE_SOLID
@ FILL_MODE_SOLID
Rasterize triangles using solid fill. Direct3D counterpart: D3D11_FILL_SOLID/D3D12_FILL_MODE_SOLID....
Definition: RasterizerState.h:57
Diligent::COMPARISON_FUNC_LESS
@ COMPARISON_FUNC_LESS
Comparison passes if the source data is less than the destination data. Direct3D counterpart: D3D11_...
Definition: GraphicsTypes.h:942
Diligent::BLEND_OPERATION_ADD
@ BLEND_OPERATION_ADD
Add source and destination color components. Direct3D counterpart: D3D11_BLEND_OP_ADD/D3D12_BLEND_OP...
Definition: BlendState.h:145
Diligent::SamplerDesc::MipLODBias
Float32 MipLODBias
Offset from the calculated mipmap level. For example, if a sampler calculates that a texture should b...
Definition: Sampler.h:89
Diligent::SamplerDesc::MaxAnisotropy
Uint32 MaxAnisotropy
Maximum anisotropy level for the anisotropic filter. Default value: 0.
Definition: Sampler.h:92
Diligent::FILTER_TYPE_COMPARISON_LINEAR
@ FILTER_TYPE_COMPARISON_LINEAR
Comparison-linear filtering.
Definition: GraphicsTypes.h:871
Diligent::BLEND_FACTOR_SRC_ALPHA
@ BLEND_FACTOR_SRC_ALPHA
The blend factor is alpha (A) data from a pixel shader. Direct3D counterpart: D3D11_BLEND_SRC_ALPHA/...
Definition: BlendState.h:73
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
Diligent::FILTER_TYPE_POINT
@ FILTER_TYPE_POINT
Point filtering.
Definition: GraphicsTypes.h:867
Diligent::BlendStateDesc
struct BlendStateDesc BlendStateDesc
Definition: BlendState.h:431
Diligent::TEXTURE_ADDRESS_MIRROR
@ TEXTURE_ADDRESS_MIRROR
Flip the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D1...
Definition: GraphicsTypes.h:900
Diligent::BLEND_FACTOR_INV_SRC_ALPHA
@ BLEND_FACTOR_INV_SRC_ALPHA
The blend factor is 1-A, where A is alpha data from a pixel shader. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:77
Diligent::DepthStencilStateDesc
struct DepthStencilStateDesc DepthStencilStateDesc
Definition: DepthStencilState.h:233
Diligent::CULL_MODE_NONE
@ CULL_MODE_NONE
Draw all triangles. Direct3D counterpart: D3D11_CULL_NONE/D3D12_CULL_MODE_NONE. OpenGL counterpart:...
Definition: RasterizerState.h:76
Diligent::FILTER_TYPE_ANISOTROPIC
@ FILTER_TYPE_ANISOTROPIC
Anisotropic filtering.
Definition: GraphicsTypes.h:869
Diligent::FILL_MODE_WIREFRAME
@ FILL_MODE_WIREFRAME
Rasterize triangles using wireframe fill. Direct3D counterpart: D3D11_FILL_WIREFRAME/D3D12_FILL_MOD...
Definition: RasterizerState.h:53
Diligent::SamplerDesc
struct SamplerDesc SamplerDesc
Definition: Sampler.h:172
Diligent::FILTER_TYPE_LINEAR
@ FILTER_TYPE_LINEAR
Linear filtering.
Definition: GraphicsTypes.h:868
Diligent::TEXTURE_ADDRESS_CLAMP
@ TEXTURE_ADDRESS_CLAMP
Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0....
Definition: GraphicsTypes.h:905
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
Diligent::RenderTargetBlendDesc
struct RenderTargetBlendDesc RenderTargetBlendDesc
Definition: BlendState.h:368
Diligent::RasterizerStateDesc
struct RasterizerStateDesc RasterizerStateDesc
Definition: RasterizerState.h:184
Diligent::TEXTURE_ADDRESS_WRAP
@ TEXTURE_ADDRESS_WRAP
Tile the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_...
Definition: GraphicsTypes.h:896
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37