106 const char* fragment_path,
107 const char** defines,
int count);
151#define SHADER_SAFE_DESTROY(s) \
Common OpenGL definitions, RAII helpers, and utilities.
@ SHADER_WARNING_THROTTLE_LIMIT
Definition shader.h:12
GLuint shader_load_compute(const char *compute_path)
Helper to load a compute program from disk.
Definition shader.c:592
Shader * shader_load_compute_program(const char *compute_path)
Loads a compute program and caches its uniforms.
Definition shader.c:716
Shader * shader_load_with_defines(const char *vertex_path, const char *fragment_path, const char **defines, int count)
Special loader that injects #define directives before compilation.
Definition shader.c:701
void shader_set_vec4_loc(GLint loc, const float *val)
Definition shader.c:865
void shader_set_int(Shader *shader, const char *name, int val)
Definition shader.c:797
void shader_set_int_loc(GLint loc, int val)
Definition shader.c:845
void shader_destroy(Shader *shader)
Destroys the shader wrapper and deletes the GL program.
Definition shader.c:722
void shader_set_vec2(Shader *shader, const char *name, const float *val)
Definition shader.c:813
char * shader_read_file(const char *path)
Reads a shader file into RAM, processing all includes.
Definition shader.c:492
void shader_set_float_loc(GLint loc, float val)
Definition shader.c:850
void shader_set_vec3(Shader *shader, const char *name, const float *val)
Definition shader.c:821
void shader_set_vec3_loc(GLint loc, const float *val)
Definition shader.c:860
char * shader_read_file_with_defines(const char *path, const char **defines, int count)
Reads a shader file and injects defines.
Definition shader.c:417
void shader_set_mat4(Shader *shader, const char *name, const float *val)
Definition shader.c:837
GLint shader_get_uniform_location(Shader *shader, const char *name)
Retrieves a uniform location via binary search on the cache.
Definition shader.c:753
Shader * shader_load(const char *vertex_path, const char *fragment_path)
Loads a linked program and caches all its active uniforms.
Definition shader.c:696
GLuint shader_compile(const char *path, GLenum type)
Compiles a single shader stage from a file.
Definition shader.c:526
void shader_set_vec4(Shader *shader, const char *name, const float *val)
Definition shader.c:829
void shader_set_vec2_loc(GLint loc, const float *val)
Definition shader.c:855
void shader_use(Shader *shader)
Activates the program for subsequent draw calls (glUseProgram).
Definition shader.c:746
GLuint shader_load_program(const char *vertex_path, const char *fragment_path)
Helper to load a classic Vertex+Fragment program from disk.
Definition shader.c:586
void shader_set_mat4_loc(GLint loc, const float *val)
Definition shader.c:870
void shader_set_float(Shader *shader, const char *name, float val)
Definition shader.c:805
Wrapper for an OpenGL program with uniform caching and automatic cleanup.
Definition shader.h:71
bool silent_warnings
Definition shader.h:78
int entry_count
Definition shader.h:75
char * name
Definition shader.h:73
int warning_count
Definition shader.h:79
GLuint program
Definition shader.h:72
UniformEntry * entries
Definition shader.h:74
int entry_capacity
Definition shader.h:76
Cached uniform metadata for fast lookup.
Definition shader.h:61
GLint location
Definition shader.h:63
char * name
Definition shader.h:62