summaryrefslogtreecommitdiff
path: root/src/shader.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-09-25 16:01:54 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-09-26 18:05:06 -0700
commita59229b6d83057650b320e44ad1f2e74f6fceac7 (patch)
tree2e204f70a800fbf0837eae70be93cc03f317747f /src/shader.h
parent6f1584f3d16ed04934da9bb1a7591ae3d4127b9a (diff)
shader: introduce shader_active_uniforms()
The existing shader api only supports caller-provided uniforms and attributes at instantiation time, with no ability to introspect what uniforms are actually actively present in a given shader. This commit adds introspection of the active uniforms for a given shader at creation time, as well as when reloaded, keeping the information around to be accessed via shader_active_uniforms(). The immediate impetus for this is supporting runtime discovery of uniforms present in the shader source, with the intention of exposing these as sequencer tracks for external manipulation.
Diffstat (limited to 'src/shader.h')
-rw-r--r--src/shader.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shader.h b/src/shader.h
index b52189a..a7df2ec 100644
--- a/src/shader.h
+++ b/src/shader.h
@@ -19,6 +19,12 @@
typedef struct shader_t shader_t;
+typedef struct shader_uniform_t {
+ char *name;
+ GLenum type;
+ int location;
+} shader_uniform_t;
+
unsigned int shader_pair_new_bare(const char *vs_src, const char *fs_src);
shader_t * shader_pair_new(const char *vs_src, const char *fs_src, unsigned n_uniforms, const char **uniforms, unsigned n_attributes, const char **attributes);
shader_t * shader_pair_new_files(const char *vs_path, const char *fs_path, unsigned n_uniforms, const char **uniforms, unsigned n_attributes, const char **attributes);
@@ -26,5 +32,6 @@ void shader_ref(shader_t *shader);
shader_t * shader_free(shader_t *shader);
void shader_use(shader_t *shader, unsigned *res_n_uniforms, int **res_uniform_locations, unsigned *res_n_attributes, int **res_attribute_locations);
int shader_reload_files(shader_t *shader);
+void shader_active_uniforms(shader_t *shader, int *res_n_uniforms, const shader_uniform_t **res_uniforms);
#endif
© All Rights Reserved