From 378bff0eddf004d131a4c83194fb3e83492c4c37 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Aug 2009 13:50:26 -0600 Subject: progs/util: added more shader utility functions --- progs/util/shaderutil.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'progs/util/shaderutil.h') diff --git a/progs/util/shaderutil.h b/progs/util/shaderutil.h index cfb8c1f3b0..607ed28491 100644 --- a/progs/util/shaderutil.h +++ b/progs/util/shaderutil.h @@ -6,7 +6,7 @@ struct uniform_info { const char *name; - GLuint size; + GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ GLenum type; /**< GL_FLOAT or GL_INT */ GLfloat value[4]; GLint location; /**< filled in by InitUniforms() */ @@ -15,6 +15,15 @@ struct uniform_info #define END_OF_UNIFORMS { NULL, 0, GL_NONE, { 0, 0, 0, 0 }, -1 } +struct attrib_info +{ + const char *name; + GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ + GLenum type; /**< GL_FLOAT or GL_INT */ + GLint location; +}; + + extern GLboolean ShadersSupported(void); @@ -30,5 +39,16 @@ LinkShaders(GLuint vertShader, GLuint fragShader); extern void InitUniforms(GLuint program, struct uniform_info uniforms[]); +extern GLuint +GetUniforms(GLuint program, struct uniform_info uniforms[]); + +extern void +PrintUniforms(const struct uniform_info uniforms[]); + +extern GLuint +GetAttribs(GLuint program, struct attrib_info attribs[]); + +extern void +PrintAttribs(const struct attrib_info attribs[]); #endif /* SHADER_UTIL_H */ -- cgit v1.2.3 From 684049d97d423a5a873aefc5313d0c4b22528b95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Aug 2009 13:53:56 -0600 Subject: demos: rename InitUniforms() to SetUniformValues() And call new PrintUniforms() in demos. --- progs/util/shaderutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs/util/shaderutil.h') diff --git a/progs/util/shaderutil.h b/progs/util/shaderutil.h index 607ed28491..22dc4dc431 100644 --- a/progs/util/shaderutil.h +++ b/progs/util/shaderutil.h @@ -37,7 +37,7 @@ extern GLuint LinkShaders(GLuint vertShader, GLuint fragShader); extern void -InitUniforms(GLuint program, struct uniform_info uniforms[]); +SetUniformValues(GLuint program, struct uniform_info uniforms[]); extern GLuint GetUniforms(GLuint program, struct uniform_info uniforms[]); -- cgit v1.2.3 From fdfb0d4b0e04bff2f3dbae2d1f8e3765fb4b0dce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Aug 2009 17:25:49 -0600 Subject: progs/glsl: change uniform_info::type field to use GLSL vector types --- progs/util/shaderutil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'progs/util/shaderutil.h') diff --git a/progs/util/shaderutil.h b/progs/util/shaderutil.h index 22dc4dc431..0a6be02675 100644 --- a/progs/util/shaderutil.h +++ b/progs/util/shaderutil.h @@ -7,7 +7,7 @@ struct uniform_info { const char *name; GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ - GLenum type; /**< GL_FLOAT or GL_INT */ + GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ GLfloat value[4]; GLint location; /**< filled in by InitUniforms() */ }; @@ -19,7 +19,7 @@ struct attrib_info { const char *name; GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ - GLenum type; /**< GL_FLOAT or GL_INT */ + GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ GLint location; }; -- cgit v1.2.3