cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
IShaderFrontend.hpp
Go to the documentation of this file.
1///
2/// @file IShaderFrontend.hpp
3/// @brief This file contains the ShaderFrontend interface
4/// @namespace cae
5///
6
7#pragma once
8
10
11#include <vector>
12
13namespace cae
14{
15
16 using ShaderID = std::string;
17
18 enum class ShaderSourceType : uint8_t
19 {
20 GLSL = 0,
21 HLSL = 1,
22 WGSL = 2,
23 MSL = 3,
24 SPIRV = 4,
25 UNDEFINED = 255
26 };
27
28 enum class ShaderStage : uint8_t
29 {
30 VERTEX = 0,
31 FRAGMENT = 1,
32 GEOMETRY = 2,
33 COMPUTE = 3,
34 UNDEFINED = 255
35 };
36
37 ///
38 /// @struct ShaderSourceDesc
39 /// @brief Struct for shader source description
40 /// @namespace cae
41 ///
49
50 ///
51 /// @struct ShaderIRModule
52 /// @brief Struct for shader intermediate representation module
53 /// @namespace cae
54 ///
56 {
59 std::vector<uint32_t> spirv;
60 std::string entryPoint = "main";
61 };
62
63 ///
64 /// @struct ShaderPipelineDesc
65 /// @brief Struct for shader pipeline description
66 /// @namespace cae
67 ///
74
75 ///
76 /// @interface IShaderFrontend
77 /// @brief Interface for shaders frontend
78 /// @namespace cae
79 ///
81 {
82
83 public:
84 ~IShaderFrontend() override = default;
85
86 ///
87 /// @return The source type this frontend handles
88 /// @brief Get the source type this frontend handles
89 ///
90 virtual ShaderSourceType sourceType() const = 0;
91
92 ///
93 /// @param desc Shader source description
94 /// @return Compiled shader intermediate representation module
95 /// @brief Compile shader source to intermediate representation
96 ///
97 virtual ShaderIRModule compile(const ShaderSourceDesc &desc) = 0;
98
99 }; // interface IShaderFrontend
100
101} // namespace cae
This file contains the plugin interface.
Class for the GLSL plugin.
Definition GLSL.hpp:26
Interface for shaders frontend.
~IShaderFrontend() override=default
virtual ShaderIRModule compile(const ShaderSourceDesc &desc)=0
Compile shader source to intermediate representation.
virtual ShaderSourceType sourceType() const =0
Get the source type this frontend handles.
Class for the SPIR-V IR plugin.
Definition SPIRV.hpp:20
Interface for plugins.
Definition IPlugin.hpp:46
std::string ShaderID
Struct for shader intermediate representation module.
std::vector< uint32_t > spirv
Struct for shader pipeline description.
Struct for shader source description.