libdonut 2.3.6
Application framework for cross-platform game development in C++20
Loading...
Searching...
No Matches
ShaderConfiguration.hpp
Go to the documentation of this file.
1#ifndef DONUT_GRAPHICS_SHADER_CONFIGURATION_HPP
2#define DONUT_GRAPHICS_SHADER_CONFIGURATION_HPP
3
4#include <compare> // std::strong_ordering
5#include <cstdint> // std::int32_t, std::uint8_t, std::uint32_t
6
7namespace donut::graphics {
8
14enum class DepthBufferMode : std::uint8_t {
18 IGNORE,
19
33};
34
40enum class DepthTestPredicate : std::uint32_t {
44 NEVER_PASS = 0x0200,
45
50 LESS = 0x0201,
51
56 LESS_OR_EQUAL = 0x0203,
57
62 GREATER = 0x0204,
63
68 GREATER_OR_EQUAL = 0x0206,
69
74 EQUAL = 0x0202,
75
80 NOT_EQUAL = 0x0205,
81
85 ALWAYS_PASS = 0x0207,
86};
87
93enum class StencilBufferMode : std::uint8_t {
97 IGNORE,
98
107};
108
114enum class StencilTestPredicate : std::uint32_t {
118 NEVER_PASS = 0x0200,
119
127 LESS = 0x0201,
128
136 LESS_OR_EQUAL = 0x0203,
137
145 GREATER = 0x0204,
146
154 GREATER_OR_EQUAL = 0x0206,
155
163 EQUAL = 0x0202,
164
172 NOT_EQUAL = 0x0205,
173
177 ALWAYS_PASS = 0x0207,
178};
179
188enum class StencilBufferOperation : std::uint32_t {
192 KEEP = 0x1E00,
193
197 SET_TO_ZERO = 0,
198
202 REPLACE = 0x1E01,
203
207 INCREMENT_CLAMP = 0x1E02,
208
213 INCREMENT_WRAP = 0x8507,
214
218 DECREMENT_CLAMP = 0x1E03,
219
224 DECREMENT_WRAP = 0x8508,
225
229 BITWISE_INVERT = 0x150A,
230};
231
237enum class FaceCullingMode : std::uint8_t {
241 IGNORE,
242
247
252
258};
259
265enum class FrontFace : std::uint32_t {
269 CLOCKWISE = 0x0900,
270
274 COUNTERCLOCKWISE = 0x0901,
275};
276
282enum class AlphaMode : std::uint8_t {
286 IGNORE,
287
294};
295
446
447} // namespace donut::graphics
448
449#endif
Definition Buffer.hpp:7
DepthBufferMode
Depth buffer mode used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:14
@ USE_DEPTH_TEST
Evaluate the depth test defined by the DepthTestPredicate to determine whether the pixel should be re...
@ IGNORE
Ignore the depth buffer.
FaceCullingMode
Face culling mode used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:237
@ CULL_FRONT_AND_BACK_FACES
Discard all faces, only render primitives without faces, such as lines and points.
@ CULL_BACK_FACES
Discard back-facing faces.
@ CULL_FRONT_FACES
Discard front-facing faces.
DepthTestPredicate
Depth test predicate used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:40
@ ALWAYS_PASS
The depth test always passes.
@ LESS
The depth test passes if and only if the new depth value is less than the old depth value.
@ NOT_EQUAL
The depth test passes if and only if the new depth value is not equal to the old depth value.
@ NEVER_PASS
The depth test always fails.
@ LESS_OR_EQUAL
The depth test passes if and only if the new depth value is less than or equal to the old depth value...
@ EQUAL
The depth test passes if and only if the new depth value is equal to the old depth value.
@ GREATER_OR_EQUAL
The depth test passes if and only if the new depth value is greater than or equal to the old depth va...
@ GREATER
The depth test passes if and only if the new depth value is greater than the old depth value.
StencilBufferMode
Stencil buffer mode used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:93
@ IGNORE
Ignore the stencil buffer.
@ USE_STENCIL_TEST
Evaluate the stencil test defined by the StencilTestPredicate to determine whether the pixel should b...
StencilTestPredicate
Stencil test predicate used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:114
@ ALWAYS_PASS
The stencil test always passes.
AlphaMode
Alpha mode used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:282
@ USE_ALPHA_BLENDING
Blend the old and new pixel colors depending on the alpha value of the new pixel according to the sta...
@ IGNORE
Ignore the alpha channel value of the rendered pixel color.
StencilBufferOperation
Operation to perform after evaluating the stencil test in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:188
@ INCREMENT_CLAMP
Increment the stencil buffer value by 1, unless it is already maxed out.
@ REPLACE
Set the stencil buffer value to the given reference value.
@ SET_TO_ZERO
Set the stencil buffer value to 0.
@ BITWISE_INVERT
Toggle each bit in the stencil buffer value.
@ KEEP
Keep the current value in the stencil buffer.
@ DECREMENT_WRAP
Decrement the stencil buffer value by 1, or wrap around to the maximum value if it was 0.
@ DECREMENT_CLAMP
Decrement the stencil buffer value by 1, unless it is already 0.
@ INCREMENT_WRAP
Increment the stencil buffer value by 1, or wrap around to 0 if it was maxed out.
FrontFace
Front face used in a ShaderConfiguration.
Definition ShaderConfiguration.hpp:265
@ COUNTERCLOCKWISE
Consider faces with counterclockwise winding order as front-facing.
@ CLOCKWISE
Consider faces with clockwise winding order as front-facing.
Base configuration options for a shader.
Definition ShaderConfiguration.hpp:299
DepthTestPredicate depthTestPredicate
The condition to check when evaluating the depth test.
Definition ShaderConfiguration.hpp:312
constexpr std::strong_ordering operator<=>(const ShaderConfiguration &other) const =default
Compare two sets of shader options.
StencilTestPredicate stencilTestPredicate
The condition to check when evaluating the stencil test.
Definition ShaderConfiguration.hpp:336
std::uint32_t stencilTestMask
The bit pattern to mask the reference value and stencil value with before performing the stencil test...
Definition ShaderConfiguration.hpp:365
StencilBufferOperation stencilBufferOperationOnStencilTestFail
The operation to perform on the stencil buffer if the stencil test fails.
Definition ShaderConfiguration.hpp:377
AlphaMode alphaMode
How to treat the alpha channel of the output pixel color while rendering.
Definition ShaderConfiguration.hpp:426
StencilBufferOperation stencilBufferOperationOnPass
The operation to perform on the stencil buffer if the stencil test and the depth test both pass.
Definition ShaderConfiguration.hpp:403
FrontFace frontFace
The winding order of front-facing faces.
Definition ShaderConfiguration.hpp:421
StencilBufferMode stencilBufferMode
How to treat the stencil buffer for each pixel being rendered.
Definition ShaderConfiguration.hpp:324
StencilBufferOperation stencilBufferOperationOnDepthTestFail
The operation to perform on the stencil buffer if the stencil test passes, but the depth test fails.
Definition ShaderConfiguration.hpp:390
constexpr bool operator==(const ShaderConfiguration &other) const =default
Compare two sets of shader options for equality.
DepthBufferMode depthBufferMode
How to treat the depth buffer for each pixel being rendered.
Definition ShaderConfiguration.hpp:305
FaceCullingMode faceCullingMode
How to treat the facing of primitives while rendering.
Definition ShaderConfiguration.hpp:414
std::int32_t stencilTestReferenceValue
The reference value to compare the stencil buffer value against when evaluating the stencil test.
Definition ShaderConfiguration.hpp:349