4#ifndef GREM_GRAPHICS_SHADERS_HPP
5#define GREM_GRAPHICS_SHADERS_HPP
46struct VertexShaderImplementation;
47struct FragmentShaderImplementation;
48struct ShaderPipelineImplementation;
732class VertexShaderBase {
743 return implementation;
754 [[nodiscard]] VertexShaderImplementation* get() noexcept {
755 return implementation.get();
766 [[nodiscard]]
const VertexShaderImplementation* get() const noexcept {
767 return implementation.get();
771 [[nodiscard]] GREM_API(graphics)
static std::vector<uint32_t> compileGLSLToVulkanSPIRVImplementation(
CStringView sourceCode,
const Filesystem* filesystem,
CStringView filepath,
795 SharedPointer<VertexShaderImplementation> implementation{};
798class FragmentShaderBase {
808 [[nodiscard]] SharedPointer<FragmentShaderImplementation> lock() const noexcept {
809 return implementation;
820 [[nodiscard]] FragmentShaderImplementation* get() noexcept {
821 return implementation.get();
832 [[nodiscard]]
const FragmentShaderImplementation* get() const noexcept {
833 return implementation.get();
837 [[nodiscard]] GREM_API(graphics)
static std::vector<uint32_t> compileGLSLToVulkanSPIRVImplementation(
CStringView sourceCode,
const Filesystem* filesystem,
CStringView filepath,
855 FragmentShaderBase(Device& device,
const Filesystem& filesystem,
CStringView filepath,
const FragmentShaderOptions& options,
862 SharedPointer<FragmentShaderImplementation> implementation{};
865class ShaderPipelineBase {
875 [[nodiscard]] SharedPointer<ShaderPipelineImplementation> lock() const noexcept {
876 return implementation;
887 [[nodiscard]] ShaderPipelineImplementation* get() noexcept {
888 return implementation.get();
899 [[nodiscard]]
const ShaderPipelineImplementation* get() const noexcept {
900 return implementation.get();
905 ShaderPipelineBase(Device& device, std::type_index meshTypeIndex, SharedPointer<VertexShaderImplementation> vertexShaderHandle,
908 Span<const byte> fragmentShaderConstantData,
const ShaderPipelineOptions& shaderPipelineOptions);
911 SharedPointer<ShaderPipelineImplementation> implementation{};
915 switch (vertexAttributeType) {
961[[nodiscard]]
inline size_t getFieldAttributeCount(
FieldType fieldType)
noexcept {
1003[[nodiscard]]
inline char getVec4ComponentCharacter(
size_t componentIndex) {
1004 switch (componentIndex) {
1013[[nodiscard]]
inline bool isValidNameStartCharacter(
char ch)
noexcept {
1014 return (ch >=
'a' && ch <=
'z') || (ch >=
'A' && ch <=
'Z');
1017[[nodiscard]]
inline bool isValidNameCharacter(
char ch)
noexcept {
1018 return (ch >=
'a' && ch <=
'z') || (ch >=
'A' && ch <=
'Z') || (ch ==
'_') || (ch >=
'0' && ch <=
'9');
1021[[nodiscard]]
inline bool isValidName(
CStringView name)
noexcept {
1022 if (name.empty() || !isValidNameStartCharacter(name.front())) {
1025 for (
const char ch : name) {
1026 if (!isValidNameCharacter(ch)) {
1040using AllocatedStringBuffer = SmallArrayList<Allocation<char>, 16>;
1041using ExpandedStringBuffer = SmallArrayList<const char*, 16>;
1043[[nodiscard]] GREM_API(graphics) ExpandedStringBuffer
1059template <
typename Mesh,
typename Constants,
typename Outputs,
typename... Buffers>
1062template <
typename Vertex,
typename Index,
typename Parameters,
typename Instance,
typename Constants,
typename Outputs,
typename... Buffers>
1063class VertexShader<
graphics::
Mesh<Vertex, Index, Parameters, Instance>, Constants, Outputs, Buffers...> :
public detail::VertexShaderBase {
1101 return detail::VertexShaderBase::compileGLSLToVulkanSPIRVImplementation(sourceCode,
nullptr, {}, compilationOptions, detail::CONSTANT_DESCRIPTIONS<Constants>,
1102 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, detail::FIELD_DESCRIPTIONS<Outputs>,
1103 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>);
1132 return detail::VertexShaderBase::compileGLSLToVulkanSPIRVImplementation(sourceCode, &filesystem, filepath, compilationOptions, detail::CONSTANT_DESCRIPTIONS<Constants>,
1133 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, detail::FIELD_DESCRIPTIONS<Outputs>,
1134 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>);
1185 return VertexShader{device, sourceCode, &filesystem, filepath};
1245 : detail::VertexShaderBase(device, filesystem, filepath, options, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type),
1246 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>,
1247 (std::is_empty_v<Instance>) ? 0 : sizeof(Instance), detail::FIELD_DESCRIPTIONS<Outputs>, detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1251 : detail::VertexShaderBase(device, sourceCode, filesystem, filepath, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type),
1252 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>,
1253 (std::is_empty_v<Instance>) ? 0 : sizeof(Instance), detail::FIELD_DESCRIPTIONS<Outputs>, detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1256 : detail::VertexShaderBase(device, code, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type), detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>,
1257 detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, (std::is_empty_v<Instance>) ? 0 : sizeof(Instance),
1258 detail::FIELD_DESCRIPTIONS<Outputs>, detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1273template <
typename Mesh,
typename Inputs,
typename Constants,
typename Outputs,
typename... Buffers>
1276template <
typename Vertex,
typename Index,
typename Parameters,
typename Instance,
typename Inputs,
typename Constants,
typename Outputs,
typename... Buffers>
1277class FragmentShader<
graphics::
Mesh<Vertex, Index, Parameters, Instance>, Inputs, Constants, Outputs, Buffers...> :
public detail::FragmentShaderBase {
1319 return detail::FragmentShaderBase::compileGLSLToVulkanSPIRVImplementation(sourceCode,
nullptr, {}, compilationOptions, detail::CONSTANT_DESCRIPTIONS<Constants>,
1320 detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, detail::FIELD_DESCRIPTIONS<Inputs>, detail::FIELD_DESCRIPTIONS<Outputs>,
1321 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>);
1350 return detail::FragmentShaderBase::compileGLSLToVulkanSPIRVImplementation(sourceCode, &filesystem, filepath, compilationOptions, detail::CONSTANT_DESCRIPTIONS<Constants>,
1351 detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, detail::FIELD_DESCRIPTIONS<Inputs>, detail::FIELD_DESCRIPTIONS<Outputs>,
1352 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>);
1403 return FragmentShader{device, sourceCode, &filesystem, filepath};
1463 : detail::FragmentShaderBase(device, filesystem, filepath, options, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type),
1464 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>,
1465 (std::is_empty_v<Instance>) ? 0 : sizeof(Instance), detail::FIELD_DESCRIPTIONS<Inputs>, detail::FIELD_DESCRIPTIONS<Outputs>,
1466 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1470 : detail::FragmentShaderBase(device, sourceCode, filesystem, filepath, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type),
1471 detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>, detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>,
1472 (std::is_empty_v<Instance>) ? 0 : sizeof(Instance), detail::FIELD_DESCRIPTIONS<Inputs>, detail::FIELD_DESCRIPTIONS<Outputs>,
1473 detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1476 : detail::FragmentShaderBase(device, code, detail::CONSTANT_DESCRIPTIONS<Constants>, typeid(mesh_type), detail::VERTEX_ATTRIBUTE_DESCRIPTIONS<Vertex>,
1477 detail::MESH_INDEX_TYPE<Index>, detail::PARAMETER_DESCRIPTIONS<Parameters>, detail::FIELD_DESCRIPTIONS<Instance>, (std::is_empty_v<Instance>) ? 0 : sizeof(Instance),
1478 detail::FIELD_DESCRIPTIONS<Inputs>, detail::FIELD_DESCRIPTIONS<Outputs>, detail::BUFFER_LAYOUT_REFERENCES<Buffers...>) {}
1483template <
typename VertexShader,
typename FragmentShader>
1484struct is_valid_shader_pipeline_combination : std::false_type {};
1486template <
typename Mesh,
typename VertexShaderConstants,
typename VertexShaderOutputs,
typename... VertexShaderBuffers,
typename FragmentShaderConstants,
1487 typename FragmentShaderOutputs,
typename... FragmentShaderBuffers>
1488struct is_valid_shader_pipeline_combination<VertexShader<Mesh, VertexShaderConstants, VertexShaderOutputs, VertexShaderBuffers...>,
1489 FragmentShader<Mesh, VertexShaderOutputs, FragmentShaderConstants, FragmentShaderOutputs, FragmentShaderBuffers...>>
1490 : meta::type_list_starts_with<meta::TypeList<FragmentShaderBuffers...>, meta::TypeList<VertexShaderBuffers...>> {};
1492template <
typename Mesh,
typename VertexShaderConstants,
typename VertexShaderOutputs,
typename... VertexShaderBuffers,
typename FragmentShaderConstants,
1493 typename FragmentShaderOutputs>
1494struct is_valid_shader_pipeline_combination<VertexShader<Mesh, VertexShaderConstants, VertexShaderOutputs, VertexShaderBuffers...>,
1495 FragmentShader<Mesh, VertexShaderOutputs, FragmentShaderConstants, FragmentShaderOutputs>> : std::true_type {};
1497template <
typename VertexShader,
typename FragmentShader>
1498inline constexpr bool is_valid_shader_pipeline_combination_v = is_valid_shader_pipeline_combination<VertexShader, FragmentShader>::value;
1507template <
typename Mesh>
1533 template <
typename VertexShaderMesh,
typename VertexShaderConstants,
typename VertexShaderOutputs,
typename... VertexShaderBuffers,
typename FragmentShaderMesh,
1534 typename FragmentShaderInputs,
typename FragmentShaderConstants,
typename FragmentShaderOutputs,
typename... FragmentShaderBuffers>
1536 const VertexShaderConstants& vertexShaderConstants,
1538 const FragmentShaderConstants& fragmentShaderConstants,
const ShaderPipelineOptions& shaderPipelineOptions)
1539 :
ShaderPipeline(device, vertexShader.lock(), vertexShaderConstants, fragmentShader.lock(), fragmentShaderConstants, shaderPipelineOptions) {
1543 static_assert(detail::is_valid_shader_pipeline_combination_v<std::remove_cvref_t<
decltype(vertexShader)>, std::remove_cvref_t<
decltype(fragmentShader)>>,
1544 "Incompatible vertex and fragment shaders.");
1582 template <
typename VertexShaderConstants,
typename FragmentShaderConstants>
1586 : detail::ShaderPipelineBase(device, typeid(
Mesh), std::
move(vertexShaderHandle), detail::CONSTANT_DESCRIPTIONS<VertexShaderConstants>,
1587 asBytes(
Span{&vertexShaderConstants, 1}), std::
move(fragmentShaderHandle), detail::CONSTANT_DESCRIPTIONS<FragmentShaderConstants>,
1588 asBytes(
Span{&fragmentShaderConstants, 1}), shaderPipelineOptions) {}
Floating-point linear RGBA color in the Rec.
Definition Color.hpp:60
static const Color WHITE
Definition Color.hpp:215
Base interface for a filesystem.
Definition Filesystem.hpp:25
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Definition SharedPointer.hpp:65
Persistent system managing the rendering context of a Window.
Definition Device.hpp:68
Constants constants_type
Constants type of the shader.
Definition shaders.hpp:1290
FragmentShader(Device &device, const Filesystem &filesystem, CStringView filepath, const FragmentShaderOptions &options={})
Load a fragment shader from a file.
Definition shaders.hpp:1462
static FragmentShader create(Device &device, CStringView sourceCode)
Create a fragment shader from GLSL source code.
Definition shaders.hpp:1374
static std::vector< uint32_t > compileGLSLToVulkanSPIRV(CStringView sourceCode, const ShaderCompilationOptions &compilationOptions={})
Compile a fragment shader from GLSL source code into SPIR-V code for Vulkan for this specic shader ty...
Definition shaders.hpp:1318
Inputs inputs_type
Inputs type of the shader.
Definition shaders.hpp:1287
static FragmentShader create(Device &device, Span< const uint32_t > code)
Create a fragment shader from SPIR-V code.
Definition shaders.hpp:1429
meta::TypeList< Buffers... > buffer_types
Buffer type list of the shader.
Definition shaders.hpp:1296
Outputs outputs_type
Outputs type of the shader.
Definition shaders.hpp:1293
graphics::Mesh< Vertex, Index, Parameters, Instance > mesh_type
Mesh type of the shader.
Definition shaders.hpp:1284
static std::vector< uint32_t > compileGLSLToVulkanSPIRV(CStringView sourceCode, const Filesystem &filesystem, CStringView filepath={}, const ShaderCompilationOptions &compilationOptions={})
Compile a fragment shader from GLSL source code into SPIR-V code for Vulkan for this specic shader ty...
Definition shaders.hpp:1348
static FragmentShader create(Device &device, CStringView sourceCode, const Filesystem &filesystem, CStringView filepath={})
Create a fragment shader from GLSL source code, with support for file inclusion.
Definition shaders.hpp:1402
Compiled GPU fragment shader stage.
Definition shaders.hpp:1274
Generic abstraction of a GPU vertex array object and its associated buffers.
Definition Mesh.hpp:209
Backend-specific implementation of RenderPass.
Definition RenderPass.hpp:38
ShaderPipeline(Device &device, SharedPointer< VertexShaderImplementation > vertexShaderHandle, const VertexShaderConstants &vertexShaderConstants, SharedPointer< FragmentShaderImplementation > fragmentShaderHandle, const FragmentShaderConstants &fragmentShaderConstants, const ShaderPipelineOptions &shaderPipelineOptions)
Link a shader pipeline.
Definition shaders.hpp:1583
Mesh mesh_type
Mesh type of the shader pipeline.
Definition shaders.hpp:1511
ShaderPipeline(Device &device, const VertexShader< VertexShaderMesh, VertexShaderConstants, VertexShaderOutputs, VertexShaderBuffers... > &vertexShader, const VertexShaderConstants &vertexShaderConstants, const FragmentShader< FragmentShaderMesh, FragmentShaderInputs, FragmentShaderConstants, FragmentShaderOutputs, FragmentShaderBuffers... > &fragmentShader, const FragmentShaderConstants &fragmentShaderConstants, const ShaderPipelineOptions &shaderPipelineOptions)
Link a shader pipeline.
Definition shaders.hpp:1535
Constants constants_type
Constants type of the shader.
Definition shaders.hpp:1072
static VertexShader create(Device &device, CStringView sourceCode, const Filesystem &filesystem, CStringView filepath={})
Create a vertex shader from GLSL source code, with support for file inclusion.
Definition shaders.hpp:1184
VertexShader(Device &device, const Filesystem &filesystem, CStringView filepath, const VertexShaderOptions &options={})
Load a vertex shader from a file.
Definition shaders.hpp:1244
static VertexShader create(Device &device, Span< const uint32_t > code)
Create a vertex shader from SPIR-V code.
Definition shaders.hpp:1211
graphics::Mesh< Vertex, Index, Parameters, Instance > mesh_type
Mesh type of the shader.
Definition shaders.hpp:1069
static std::vector< uint32_t > compileGLSLToVulkanSPIRV(CStringView sourceCode, const Filesystem &filesystem, CStringView filepath={}, const ShaderCompilationOptions &compilationOptions={})
Compile a vertex shader from GLSL source code into SPIR-V code for Vulkan for this specic shader type...
Definition shaders.hpp:1130
static VertexShader create(Device &device, CStringView sourceCode)
Create a vertex shader from GLSL source code.
Definition shaders.hpp:1156
Outputs outputs_type
Outputs type of the shader.
Definition shaders.hpp:1075
meta::TypeList< Buffers... > buffer_types
Buffer type list of the shader.
Definition shaders.hpp:1078
static std::vector< uint32_t > compileGLSLToVulkanSPIRV(CStringView sourceCode, const ShaderCompilationOptions &compilationOptions={})
Compile a vertex shader from GLSL source code into SPIR-V code for Vulkan for this specic shader type...
Definition shaders.hpp:1100
Compiled GPU vertex shader stage.
Definition shaders.hpp:1060
Concept that checks if a type is a valid field struct type for a shader-read buffer.
Definition FieldDescription.hpp:123
Concept that checks if a type is a valid shader constant struct type.
Definition ConstantDescription.hpp:84
Definition concepts.hpp:35
Definition buffer_layouts.hpp:20
PrimitiveType
Graphical primitive type formed by mesh vertices, used in a ShaderPipelineOptions.
Definition shaders.hpp:290
@ TRIANGLE_STRIP
Each point, except the first two, forms a filled triangle with the previous two points.
Definition shaders.hpp:296
@ POINTS
Individual points.
Definition shaders.hpp:291
@ TRIANGLES
Each consecutive triple of points forms an individual filled triangle.
Definition shaders.hpp:295
@ LINES
Each consecutive pair of points forms an individual line segment.
Definition shaders.hpp:292
@ LINE_STRIP
Each point, except the first, forms a line segment to the previous point.
Definition shaders.hpp:294
BlendFactor
Blend factor used in the BlendState of a ShaderPipelineOptions.
Definition shaders.hpp:353
@ DESTINATION_COLOR
Multiply all components by the destination components.
Definition shaders.hpp:358
@ ONE_MINUS_DESTINATION__ALPHA
Multiply all components by 1 minus the destination alpha.
Definition shaders.hpp:363
@ CONSTANT_COLOR
Multiply all components by the constant components.
Definition shaders.hpp:364
@ SOURCE_COLOR
Multiply all components by the source components.
Definition shaders.hpp:356
@ ONE_MINUS_CONSTANT_ALPHA
Multiply all components by 1 minus the constant alpha.
Definition shaders.hpp:367
@ SOURCE_ALPHA
Multiply all components by the source alpha.
Definition shaders.hpp:360
@ ONE_MINUS_CONSTANT_COLOR
Multiply all components by 1 minus each constant component.
Definition shaders.hpp:365
@ ZERO
Multiply all components by 0.
Definition shaders.hpp:354
@ ONE_MINUS_SOURCE_ALPHA
Multiply all components by 1 minus the source alpha.
Definition shaders.hpp:361
@ ONE_MINUS_SOURCE_COLOR
Multiply all components by 1 minus each source component.
Definition shaders.hpp:357
@ SOURCE_ALPHA_SATURATE
Multiply the color components by the smaller of the source alpha or 1 minus the destination alpha,...
Definition shaders.hpp:368
@ DESTINATION_ALPHA
Multiply all components by the destination alpha.
Definition shaders.hpp:362
@ CONSTANT_ALPHA
Multiply all components by the constant alpha.
Definition shaders.hpp:366
@ ONE_MINUS_DESTINATION_COLOR
Multiply all components by 1 minus each destination component.
Definition shaders.hpp:359
@ ONE
Multiply all components by 1.
Definition shaders.hpp:355
PolygonMode
Polygon mode used in a ShaderPipelineOptions.
Definition shaders.hpp:304
@ LINE
Polygon edges are drawn as single-pixel-wide line segments.
Definition shaders.hpp:306
@ POINT
Polygon vertices are drawn as single-pixel points.
Definition shaders.hpp:305
@ FILL
Polygon faces are filled in.
Definition shaders.hpp:307
DepthBufferMode
Backend-specific implementation of ShaderPipeline.
Definition shaders.hpp:55
@ USE_DEPTH_TEST
Evaluate the depth test defined by the DepthTestPredicate to determine whether the pixel should be re...
Definition shaders.hpp:74
@ NONE
Ignore the depth buffer.
Definition shaders.hpp:59
@ USE_DEPTH_TEST_READ_ONLY
Evaluate the depth test defined by the DepthTestPredicate to determine whether the pixel should be re...
Definition shaders.hpp:84
FaceCullingMode
Face culling mode used in a ShaderPipelineOptions.
Definition shaders.hpp:315
@ CULL_FRONT_AND_BACK_FACES
Discard all faces, only render primitives without faces, such as lines and points.
Definition shaders.hpp:335
@ CULL_BACK_FACES
Discard back-facing faces.
Definition shaders.hpp:324
@ CULL_FRONT_FACES
Discard front-facing faces.
Definition shaders.hpp:329
BlendOperation
Blend operation used in the BlendState of a ShaderPipelineOptions.
Definition shaders.hpp:376
@ MAX
Take the maximum of the components.
Definition shaders.hpp:381
@ REVERSE_SUBTRACT
Subtract the blended source components from the blended destination components.
Definition shaders.hpp:379
@ ADD
Add the blended components.
Definition shaders.hpp:377
@ MIN
Take the minimum of the components.
Definition shaders.hpp:380
StencilTestPredicate
Stencil test predicate used in a ShaderPipelineOptions.
Definition shaders.hpp:166
@ ALWAYS_PASS
The stencil test always passes.
Definition shaders.hpp:229
FieldType
Specification of the underlying value type of a field of a shader-read buffer.
Definition FieldDescription.hpp:52
@ UINT
C++: uint32_t, GLSL: uint.
Definition FieldDescription.hpp:57
@ MAT3
C++: mat3, GLSL: mat3.
Definition FieldDescription.hpp:66
@ IVEC4
C++: i32vec4, GLSL: ivec4.
Definition FieldDescription.hpp:56
@ MAT4
C++: mat4, GLSL: mat4.
Definition FieldDescription.hpp:67
@ INT
C++: int32_t, GLSL: int.
Definition FieldDescription.hpp:53
@ UVEC2
C++: u32vec2, GLSL: uvec2.
Definition FieldDescription.hpp:58
@ IVEC3
C++: i32vec3, GLSL: ivec3.
Definition FieldDescription.hpp:55
@ VEC2
C++: vec2, GLSL: vec2.
Definition FieldDescription.hpp:62
@ UVEC4
C++: u32vec4, GLSL: uvec4.
Definition FieldDescription.hpp:60
@ VEC3
C++: vec3, GLSL: vec3.
Definition FieldDescription.hpp:63
@ UVEC3
C++: u32vec3, GLSL: uvec3.
Definition FieldDescription.hpp:59
@ MAT2
C++: mat2, GLSL: mat2.
Definition FieldDescription.hpp:65
@ FLOAT
C++: float, GLSL: float.
Definition FieldDescription.hpp:61
@ VEC4
C++: vec4, GLSL: vec4.
Definition FieldDescription.hpp:64
@ IVEC2
C++: i32vec2, GLSL: ivec2.
Definition FieldDescription.hpp:54
StencilBufferMode
Stencil buffer mode used in a ShaderPipelineOptions.
Definition shaders.hpp:145
@ NONE
Ignore the stencil buffer.
Definition shaders.hpp:149
@ USE_STENCIL_TEST
Evaluate the stencil test defined by the StencilTestPredicate to determine whether the pixel should b...
Definition shaders.hpp:158
FrontFace
Front face winding order used in a ShaderPipelineOptions.
Definition shaders.hpp:343
@ COUNTERCLOCKWISE
Consider faces with counterclockwise winding order to be front-facing.
Definition shaders.hpp:344
@ CLOCKWISE
Consider faces with clockwise winding order to be front-facing.
Definition shaders.hpp:345
StencilBufferOperation
Operation to perform after evaluating the stencil test in a ShaderPipelineOptions.
Definition shaders.hpp:240
@ REPLACE
Set the stencil buffer value to the given reference value.
Definition shaders.hpp:254
@ SET_TO_ZERO
Set the stencil buffer value to 0.
Definition shaders.hpp:249
@ BITWISE_INVERT
Toggle each bit in the stencil buffer value.
Definition shaders.hpp:281
@ KEEP
Keep the current value in the stencil buffer.
Definition shaders.hpp:244
@ INCREMENT_AND_WRAP
Increment the stencil buffer value by 1, or wrap around to 0 if it was maxed out.
Definition shaders.hpp:265
@ DECREMENT_AND_WRAP
Decrement the stencil buffer value by 1, or wrap around to the maximum value if it was 0.
Definition shaders.hpp:276
@ INCREMENT_AND_CLAMP
Increment the stencil buffer value by 1, unless it is already maxed out.
Definition shaders.hpp:259
@ DECREMENT_AND_CLAMP
Decrement the stencil buffer value by 1, unless it is already 0.
Definition shaders.hpp:270
VertexAttributeType
Specification of the underlying value type of a vertex attribute.
Definition VertexAttributeDescription.hpp:75
@ I8NORM
Definition VertexAttributeDescription.hpp:77
@ U32VEC3
Definition VertexAttributeDescription.hpp:111
@ I8VEC2
Definition VertexAttributeDescription.hpp:83
@ I16VEC4NORM
Definition VertexAttributeDescription.hpp:101
@ I16VEC4
Definition VertexAttributeDescription.hpp:103
@ U8VEC2NORM
Definition VertexAttributeDescription.hpp:80
@ U16VEC2
Definition VertexAttributeDescription.hpp:97
@ I32VEC3
Definition VertexAttributeDescription.hpp:112
@ I32VEC2
Definition VertexAttributeDescription.hpp:109
@ U32VEC4
Definition VertexAttributeDescription.hpp:114
@ I16VEC2NORM
Definition VertexAttributeDescription.hpp:96
@ F32
Definition VertexAttributeDescription.hpp:107
@ U8NORM
Definition VertexAttributeDescription.hpp:76
@ I16VEC2
Definition VertexAttributeDescription.hpp:98
@ F16
Definition VertexAttributeDescription.hpp:94
@ I8
Definition VertexAttributeDescription.hpp:79
@ U8
Definition VertexAttributeDescription.hpp:78
@ U8VEC2
Definition VertexAttributeDescription.hpp:82
@ UA2B10G10R10VEC4NORM
Definition VertexAttributeDescription.hpp:88
@ U8VEC4NORM
Definition VertexAttributeDescription.hpp:84
@ I8VEC2NORM
Definition VertexAttributeDescription.hpp:81
@ F16VEC4
Definition VertexAttributeDescription.hpp:104
@ U16VEC4
Definition VertexAttributeDescription.hpp:102
@ U16VEC2NORM
Definition VertexAttributeDescription.hpp:95
@ IA2B10G10R10VEC4NORM
Definition VertexAttributeDescription.hpp:89
@ U16VEC4NORM
Definition VertexAttributeDescription.hpp:100
@ I16
Definition VertexAttributeDescription.hpp:93
@ F32VEC4
Definition VertexAttributeDescription.hpp:116
@ U16NORM
Definition VertexAttributeDescription.hpp:90
@ U32
Definition VertexAttributeDescription.hpp:105
@ I32VEC4
Definition VertexAttributeDescription.hpp:115
@ I16NORM
Definition VertexAttributeDescription.hpp:91
@ F32VEC3
Definition VertexAttributeDescription.hpp:113
@ I32
Definition VertexAttributeDescription.hpp:106
@ F32VEC2
Definition VertexAttributeDescription.hpp:110
@ I8VEC4NORM
Definition VertexAttributeDescription.hpp:85
@ U32VEC2
Definition VertexAttributeDescription.hpp:108
@ F16VEC2
Definition VertexAttributeDescription.hpp:99
@ U16
Definition VertexAttributeDescription.hpp:92
@ U8VEC4
Definition VertexAttributeDescription.hpp:86
@ I8VEC4
Definition VertexAttributeDescription.hpp:87
DepthTestPredicate
Depth test predicate used in a ShaderPipelineOptions.
Definition shaders.hpp:92
@ ALWAYS_PASS
The depth test always passes.
Definition shaders.hpp:137
@ LESS
The depth test passes if and only if the new depth value is less than the old depth value.
Definition shaders.hpp:102
@ NOT_EQUAL
The depth test passes if and only if the new depth value is not equal to the old depth value.
Definition shaders.hpp:132
@ NEVER_PASS
The depth test always fails.
Definition shaders.hpp:96
@ 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...
Definition shaders.hpp:108
@ EQUAL
The depth test passes if and only if the new depth value is equal to the old depth value.
Definition shaders.hpp:126
@ 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...
Definition shaders.hpp:120
@ GREATER
The depth test passes if and only if the new depth value is greater than the old depth value.
Definition shaders.hpp:114
constexpr Add ADD
Definition algorithms.hpp:76
constexpr Subtract SUBTRACT
Definition algorithms.hpp:84
GREM_ALWAYS_INLINE void lock(Lockable1 &lock1, Lockable2 &lock2, LockableN &... lockN)
Definition synchronization.hpp:1268
constexpr auto move(input_range auto &&range, auto outputIterator)
Definition algorithms.hpp:669
Span(R &&range) -> Span< std::remove_reference_t< decltype(*std::data(range))> >
void unreachable()
Definition assertions.hpp:125
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
StringViewBase< char, std::char_traits< char > > StringView
Definition StringView.hpp:16
auto asBytes(Span< T, N > s) noexcept
Definition Span.hpp:359
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635
Blend state used in a ShaderPipelineOptions.
Definition shaders.hpp:389
BlendOperation alphaBlendOperation
Alpha blend operation.
Definition shaders.hpp:398
BlendFactor destinationColorBlendFactor
Blend factor of the destination color.
Definition shaders.hpp:394
Color blendConstants
Constant blend color.
Definition shaders.hpp:399
constexpr bool operator==(const BlendState &other) const noexcept=default
Compare this blend state to another for equality.
BlendFactor sourceColorBlendFactor
Blend factor of the source color.
Definition shaders.hpp:393
BlendOperation colorBlendOperation
Color blend operation.
Definition shaders.hpp:395
BlendFactor destinationAlphaBlendFactor
Blend factor of the destination alpha.
Definition shaders.hpp:397
static const BlendState ALPHA_BLENDING_STRAIGHT
Blend state to use for straight alpha blending using the standard "over" operator.
Definition shaders.hpp:390
BlendFactor sourceAlphaBlendFactor
Blend factor of the source alpha.
Definition shaders.hpp:396
static const BlendState ALPHA_BLENDING_PREMULTIPLIED
Blend state to use for pre-multiplied alpha blending using the standard "over" operator.
Definition shaders.hpp:391
Configuration options for loading a FragmentShader.
Definition shaders.hpp:712
bool useCorrespondingCompiledFileIfAvailable
Under the Vulkan backend, if appending ".spv" to the specified filepath yields the path of a valid fi...
Definition shaders.hpp:720
String compiledFileDirectory
If non-empty, and useCorrespondingCompiledFileIfAvailable is true, specifies the directory in which t...
Definition shaders.hpp:727
Options for compiling shader code.
Definition shaders.hpp:681
bool optimize
Whether to optimize the generated code or leave it more debuggable.
Definition shaders.hpp:685
Configuration of a graphics pipeline.
Definition shaders.hpp:428
StencilBufferOperation stencilBufferOperationOnBackFaceStencilTestFail
The operation to perform on the stencil buffer when the stencil test fails for back faces.
Definition shaders.hpp:593
StencilBufferMode stencilBufferMode
How to treat the stencil buffer for each pixel being rendered.
Definition shaders.hpp:459
PolygonMode polygonMode
How to render polygons.
Definition shaders.hpp:629
FaceCullingMode faceCullingMode
How to treat the facing of primitives while rendering.
Definition shaders.hpp:640
StencilBufferOperation stencilBufferOperationOnFrontFacePass
The operation to perform on the stencil buffer when the stencil test and the depth test both pass for...
Definition shaders.hpp:539
DepthBufferMode depthBufferMode
How to treat the depth buffer for each pixel being rendered.
Definition shaders.hpp:434
float depthBiasSlopeFactor
Slope-scaled depth bias factor.
Definition shaders.hpp:659
Optional< BlendState > blendState
How to blend the pixel color with the output while rendering.
Definition shaders.hpp:652
uint8_t stencilTestBackFaceMask
The bit pattern to mask the reference value and stencil value with before performing the stencil test...
Definition shaders.hpp:580
FrontFace frontFace
The winding order of front-facing faces.
Definition shaders.hpp:647
DepthTestPredicate depthTestPredicate
The condition to check when evaluating the depth test.
Definition shaders.hpp:441
uint8_t stencilTestFrontFaceMask
The bit pattern to mask the reference value and stencil value with before performing the stencil test...
Definition shaders.hpp:500
int8_t stencilTestBackFaceReferenceValue
The reference value to compare the stencil buffer value against when evaluating the stencil test for ...
Definition shaders.hpp:564
StencilTestPredicate stencilTestFrontFacePredicate
The condition to check when evaluating the stencil test for front faces.
Definition shaders.hpp:471
StencilBufferOperation stencilBufferOperationOnBackFacePass
The operation to perform on the stencil buffer when the stencil test and the depth test both pass for...
Definition shaders.hpp:619
StencilTestPredicate stencilTestBackFacePredicate
The condition to check when evaluating the stencil test for back faces.
Definition shaders.hpp:551
PrimitiveType primitiveType
How to form primitives out of consecutive mesh vertices.
Definition shaders.hpp:624
float depthBiasConstantFactor
Constant depth bias factor.
Definition shaders.hpp:666
StencilBufferOperation stencilBufferOperationOnFrontFaceStencilTestFail
The operation to perform on the stencil buffer when the stencil test fails for front faces.
Definition shaders.hpp:513
StencilBufferOperation stencilBufferOperationOnBackFaceDepthTestFail
The operation to perform on the stencil buffer when the stencil test passes, but the depth test fails...
Definition shaders.hpp:606
StencilBufferOperation stencilBufferOperationOnFrontFaceDepthTestFail
The operation to perform on the stencil buffer when the stencil test passes, but the depth test fails...
Definition shaders.hpp:526
constexpr bool operator==(const ShaderPipelineOptions &other) const noexcept=default
Compare this configuration to another for equality.
int8_t stencilTestFrontFaceReferenceValue
The reference value to compare the stencil buffer value against when evaluating the stencil test for ...
Definition shaders.hpp:484
Configuration options for loading a VertexShader.
Definition shaders.hpp:691
bool useCorrespondingCompiledFileIfAvailable
Under the Vulkan backend, if appending ".spv" to the specified filepath yields the path of a valid fi...
Definition shaders.hpp:699
String compiledFileDirectory
If non-empty, and useCorrespondingCompiledFileIfAvailable is true, specifies the directory in which t...
Definition shaders.hpp:706