xref: /haiku/src/tests/kits/opengl/glsl/shaderutil.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 #ifndef SHADER_UTIL_H
2 #define SHADER_UTIL_H
3 
4 
5 
6 struct uniform_info
7 {
8    const char *name;
9    GLuint size;  /**< number of value[] elements: 1, 2, 3 or 4 */
10    GLenum type;  /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */
11    GLfloat value[4];
12    GLint location;  /**< filled in by InitUniforms() */
13 };
14 
15 #define END_OF_UNIFORMS   { NULL, 0, GL_NONE, { 0, 0, 0, 0 }, -1 }
16 
17 
18 struct attrib_info
19 {
20    const char *name;
21    GLuint size;  /**< number of value[] elements: 1, 2, 3 or 4 */
22    GLenum type;  /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */
23    GLint location;
24 };
25 
26 
27 extern GLboolean
28 ShadersSupported(void);
29 
30 extern GLuint
31 CompileShaderText(GLenum shaderType, const char *text);
32 
33 extern GLuint
34 CompileShaderFile(GLenum shaderType, const char *filename);
35 
36 extern GLuint
37 LinkShaders(GLuint vertShader, GLuint fragShader);
38 
39 extern GLboolean
40 ValidateShaderProgram(GLuint program);
41 
42 extern GLdouble
43 GetShaderCompileTime(void);
44 
45 extern GLdouble
46 GetShaderLinkTime(void);
47 
48 extern void
49 SetUniformValues(GLuint program, struct uniform_info uniforms[]);
50 
51 extern GLuint
52 GetUniforms(GLuint program, struct uniform_info uniforms[]);
53 
54 extern void
55 PrintUniforms(const struct uniform_info uniforms[]);
56 
57 extern GLuint
58 GetAttribs(GLuint program, struct attrib_info attribs[]);
59 
60 extern void
61 PrintAttribs(const struct attrib_info attribs[]);
62 
63 #endif /* SHADER_UTIL_H */
64