Class Shaders::ShaderUnit
ClassList > Shaders > ShaderUnit
Individual shader compilation unit (vertex, fragment, compute, etc.). More...
#include <Shaders.h>
Classes
| Type | Name |
|---|---|
| struct | hash_fn Hash function for using ShaderUnit in unordered containers. |
Public Attributes
| Type | Name |
|---|---|
| GLuint | sh_ID = { 0 }OpenGL shader object ID. |
| std::string | sh_code = { "" }GLSL source code. |
| std::string | sh_name = { "" }Shader name (usually file name) |
| std::optional< ShaderStruct > | sh_struct = {}Parsed GLSL structure (uniforms, attributes) |
| ShaderType | sh_type = { NONE\_SHADER }Shader stage type (vertex, fragment, etc.) |
Public Functions
| Type | Name |
|---|---|
| ShaderUnit () Default constructor. |
|
| ShaderUnit (ShaderType type, std::string name) Constructs a shader unit with type and name. |
|
| ShaderUnit (const ShaderUnit & unit) Copy constructor (deep copy of shader data). |
|
| ShaderUnit (ShaderUnit && unit) noexcept Move constructor (transfers ownership). |
|
| ShaderUnit & | operator= (const ShaderUnit & unit) Copy assignment operator. |
| ShaderUnit & | operator= (ShaderUnit && unit) noexcept Move assignment operator (transfers ownership). |
| ~ShaderUnit () Destructor (releases OpenGL shader object). |
Detailed Description
Represents a single shader stage with its source code, compiled shader ID, and optional GLSL structure metadata. ShaderUnits are compiled into OpenGL shader objects (vertex, fragment, etc.) and then linked into a program.
GPU Resource Ownership: * Owns OpenGL shader object (sh_ID) * Released via glDeleteShader in destructor or _del() * Move semantics transfer ownership
Public Attributes Documentation
variable sh_ID
OpenGL shader object ID.
GLuint Shaders::ShaderUnit::sh_ID;
variable sh_code
GLSL source code.
std::string Shaders::ShaderUnit::sh_code;
variable sh_name
Shader name (usually file name)
std::string Shaders::ShaderUnit::sh_name;
variable sh_struct
Parsed GLSL structure (uniforms, attributes)
std::optional<ShaderStruct> Shaders::ShaderUnit::sh_struct;
variable sh_type
Shader stage type (vertex, fragment, etc.)
ShaderType Shaders::ShaderUnit::sh_type;
Public Functions Documentation
function ShaderUnit [1/4]
Default constructor.
inline Shaders::ShaderUnit::ShaderUnit ()
function ShaderUnit [2/4]
Constructs a shader unit with type and name.
Shaders::ShaderUnit::ShaderUnit (
ShaderType type,
std::string name
)
Parameters:
typeShader stage typenameShader name/file name
function ShaderUnit [3/4]
Copy constructor (deep copy of shader data).
Shaders::ShaderUnit::ShaderUnit (
const ShaderUnit & unit
)
Parameters:
unitSource shader unit to copy
function ShaderUnit [4/4]
Move constructor (transfers ownership).
Shaders::ShaderUnit::ShaderUnit (
ShaderUnit && unit
) noexcept
Parameters:
unitSource shader unit to move from
function operator=
Copy assignment operator.
ShaderUnit & Shaders::ShaderUnit::operator= (
const ShaderUnit & unit
)
Parameters:
unitSource shader unit to copy
Returns:
Reference to this shader unit
function operator=
Move assignment operator (transfers ownership).
ShaderUnit & Shaders::ShaderUnit::operator= (
ShaderUnit && unit
) noexcept
Parameters:
unitSource shader unit to move from
Returns:
Reference to this shader unit
function ~ShaderUnit
Destructor (releases OpenGL shader object).
Shaders::ShaderUnit::~ShaderUnit ()
The documentation for this class was generated from the following file src/render/Shaders.h