From 7c1edef3ac501d40e3de495b9434df71f535e9bc Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 19 Oct 2018 23:22:07 +0300 Subject: Allow multiple shaders while reducing duplication This change also stops using bie as eventually it will be replaced with a more sophisticated asset handling system which will also allow custom shaders. --- glprog.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'glprog.h') diff --git a/glprog.h b/glprog.h index cd0ef83..74987b3 100644 --- a/glprog.h +++ b/glprog.h @@ -7,17 +7,25 @@ #include "gl.h" -struct unidat { - const char *name; - GLint *loc; +struct shader { + GLuint prog; + struct { +#define SH_UNI(_, name) GLint name; +#include "shaders/data.h" + } uni; + struct { +#define SH_TEX(_, name) GLint name; +#include "shaders/data.h" + } tex; }; -struct shdrdat { - GLuint type; - const char *src; - GLint len; +struct glprog_progs { +#define SH_PROG(name) struct shader name; +#include "shaders/data.h" }; -GLuint glprog_load(const struct shdrdat *shdrs, const struct unidat *unis); +extern struct glprog_progs prog; -#endif // SHADER_H +void glprog_init(void); + +#endif // GLPROG_H -- cgit v1.2.3-54-g00ecf