SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
ShaderStages.h
1#pragma once
2
3#include "spark/base/Macros.h"
4
5namespace spark::render
6{
10 enum class ShaderStage
11 {
13 Vertex = 0x00000001,
14
16 TessellationControl = 0x00000002,
17
19 TessellationEvaluation = 0x00000004,
20
23 Geometry = 0x00000008,
24
26 Fragment = 0x00000010,
27
29 Compute = 0x00000020,
30
32 Other = 0x7FFFFFFF
33 };
34
35 SPARK_DEFINE_ENUM_FLAGS(ShaderStage);
36}
37
38template <>
39struct std::formatter<spark::render::ShaderStage>
40{
41 static constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
42
43 static constexpr auto format(const spark::render::ShaderStage stage, auto& ctx)
44 {
45 switch (stage) // NOLINT(clang-diagnostic-switch-enum): Other is handled after the switch statement.
46 {
47 case spark::render::ShaderStage::Vertex:
48 return std::format_to(ctx.out(), "Vertex");
49 case spark::render::ShaderStage::TessellationControl:
50 return std::format_to(ctx.out(), "TessellationControl");
51 case spark::render::ShaderStage::TessellationEvaluation:
52 return std::format_to(ctx.out(), "TessellationEvaluation");
53 case spark::render::ShaderStage::Geometry:
54 return std::format_to(ctx.out(), "Geometry");
55 case spark::render::ShaderStage::Fragment:
56 return std::format_to(ctx.out(), "Fragment");
57 case spark::render::ShaderStage::Compute:
58 return std::format_to(ctx.out(), "Compute");
59 default:
60 break;
61 }
62 return std::format_to(ctx.out(), "Other");
63 }
64};