summaryrefslogtreecommitdiffstats
path: root/progs/util/shaderutil.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-25 17:36:28 -0600
committerBrian Paul <[email protected]>2009-08-25 17:46:10 -0600
commitfa6299cb31b62ff2418138cbb789b900d19a0bca (patch)
treeb5a8f647688dbce3da07c89249a6c1f07254e29f /progs/util/shaderutil.c
parentb7d2023cf99319c71a929c35478dff07d35df392 (diff)
progs/util: added ValidateShaderProgram() to shaderutil.c
Diffstat (limited to 'progs/util/shaderutil.c')
-rw-r--r--progs/util/shaderutil.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index c58c249831e..4db950016b8 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -140,6 +140,25 @@ LinkShaders(GLuint vertShader, GLuint fragShader)
}
+GLboolean
+ValidateShaderProgram(GLuint program)
+{
+ GLint stat;
+ glValidateProgramARB(program);
+ glGetProgramiv(program, GL_VALIDATE_STATUS, &stat);
+
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ glGetProgramInfoLog(program, 1000, &len, log);
+ fprintf(stderr, "Program validation error:\n%s\n", log);
+ return 0;
+ }
+
+ return (GLboolean) stat;
+}
+
+
GLdouble
GetShaderCompileTime(void)
{
@@ -170,6 +189,7 @@ SetUniformValues(GLuint program, struct uniform_info uniforms[])
case GL_SAMPLER_3D:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_2D_RECT_ARB:
+ assert(uniforms[i].value[0] >= 0.0F);
glUniform1i(uniforms[i].location,
(GLint) uniforms[i].value[0]);
break;