summaryrefslogtreecommitdiff
path: root/src/pig.c
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/pig.c
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/pig.c')
-rw-r--r--src/pig.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pig.c b/src/pig.c
index 6c11c67..6161b8d 100644
--- a/src/pig.c
+++ b/src/pig.c
@@ -72,10 +72,12 @@ static void randomize_color(v3f_t *color)
static void pig_uniforms_func(shader_t *shader, void *uniforms_ctxt, void *render_ctxt, unsigned n_uniforms, const int *uniforms, const m4f_t *model_x, float alpha)
{
- play_t *play = render_ctxt;
- pig_t *pig = uniforms_ctxt;
- unsigned t0, t1;
- float r = randf();
+ play_t *play = render_ctxt;
+ pig_t *pig = uniforms_ctxt;
+ unsigned t0, t1;
+ float r = randf();
+ const shader_uniform_t *active_uniforms;
+ int n_active_uniforms;
if (play_ticks_elapsed(play, PLAY_TICKS_TIMER2, 1000)) {
if (shader_reload_files(shader) < 0)
© All Rights Reserved