libdonut 2.3.6
Application framework for cross-platform game development in C++20
Loading...
Searching...
No Matches
ShaderStage.hpp
Go to the documentation of this file.
1#ifndef DONUT_GRAPHICS_SHADER_STAGE_HPP
2#define DONUT_GRAPHICS_SHADER_STAGE_HPP
3
6
7namespace donut::graphics {
8
12enum class ShaderStageType : unsigned {
13 VERTEX_SHADER = 0x8B31,
14 FRAGMENT_SHADER = 0x8B30,
15};
16
21public:
25 constexpr explicit ShaderStage() noexcept = default;
26
41 explicit ShaderStage(ShaderStageType type, const char* definitions, const char* sourceCode);
42
48 explicit operator bool() const noexcept {
49 return static_cast<bool>(shader);
50 }
51
62 [[nodiscard]] Handle get() const noexcept {
63 return shader.get();
64 }
65
66private:
67 struct ShaderDeleter {
68 void operator()(Handle handle) const noexcept;
69 };
70
72};
73
74} // namespace donut::graphics
75
76#endif
Generic nullable RAII resource handle with exclusive ownership of a resource that is automatically de...
Definition UniqueHandle.hpp:21
constexpr Handle get() const noexcept
Get the value of the underlying resource handle.
Definition UniqueHandle.hpp:152
Compiled GPU code for a specific stage of a ShaderProgram.
Definition ShaderStage.hpp:20
constexpr ShaderStage() noexcept=default
Construct an empty shader stage without a value.
Handle get() const noexcept
Get an opaque handle to the GPU representation of the shader stage.
Definition ShaderStage.hpp:62
Definition Buffer.hpp:7
std::uint32_t Handle
Generic GPU resource handle.
Definition Handle.hpp:11
ShaderStageType
Type of a ShaderStage in a ShaderProgram.
Definition ShaderStage.hpp:12
@ FRAGMENT_SHADER
Fragment/pixel shader.