Skip to content

File Shaders.h

FileList > render > Shaders.h

Go to the source code of this file

Base shader abstraction for GPU shader compilation, linking, and uniform management. More...

  • #include "ShaderLib.h"
  • #include <optional>
  • #include <functional>

Classes

Type Name
class Shaders
Base class for OpenGL shader programs.
struct ArrayUni
Array uniform data container.
struct ShaderPair
Pair of vertex and fragment shader names for loading.
class ShaderUnit
Individual shader compilation unit (vertex, fragment, compute, etc.).
struct hash_fn
Hash function for using ShaderUnit in unordered containers.

Public Types

Type Name
enum ArrayType
Types of array data supported for uniform arrays.
enum ShaderType
Shader stage types supported by the renderer.

Macros

Type Name
define Uni std::make\_tuple
Helper macro for creating uniform tuples.

Detailed Description

Provides the foundational Shaders class that manages OpenGL shader programs, including compilation of shader units (vertex, fragment, compute, geometry), linking into programs, and runtime uniform setting. This is the base class for specialized shader types (RenderShader, ComputeShader, etc.).

GPU Resource Ownership: * Shaders owns the OpenGL program object (program_id) * Shader units (vertex/fragment/etc.) are owned by derived classes * Resources are deleted in destructor via glDeleteProgram

Architecture: * Pure virtual methods enforce shader type-specific behavior * Derived classes implement shader parsing, compilation, and linking * Uniform cache minimizes redundant glGetUniformLocation calls

Public Types Documentation

enum ArrayType

Types of array data supported for uniform arrays.

enum ArrayType {
    NULL_ARRAY,
    VEC1_ARRAY,
    VEC2_ARRAY,
    VEC3_ARRAY,
    VEC4_ARRAY,
    MAT4_ARRAY
};


enum ShaderType

Shader stage types supported by the renderer.

enum ShaderType {
    NONE_SHADER = -1,
    VERTEX_SHADER,
    FRAGMENT_SHADER,
    COMPUTE_SHADER,
    GEOMETRY_SHADER
};


Macro Definition Documentation

define Uni

Helper macro for creating uniform tuples.

#define Uni `std::make_tuple`

Usage: Uni("uniform_name", value)



The documentation for this class was generated from the following file src/render/Shaders.h