From bc985b5790bcbf2d19b2e42fee0807b1a3c9bc91 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Jul 2008 14:16:07 -0600 Subject: [PATCH] mesa: fix some issues in _mesa_validate_program() --- src/mesa/shader/shader_api.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index b77b86c6fa0..25c0484feb2 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1534,15 +1534,19 @@ static void _mesa_validate_program(GLcontext *ctx, GLuint program) { struct gl_shader_program *shProg; - shProg = _mesa_lookup_shader_program(ctx, program); + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram"); if (!shProg) { - _mesa_error(ctx, GL_INVALID_VALUE, "glValidateProgram(program)"); return; } - /* XXX temporary */ - shProg->Validated = GL_TRUE; - /* From the GL spec: + if (!shProg->LinkStatus) { + shProg->Validated = GL_FALSE; + return; + } + + /* From the GL spec, a program is invalid if any of these are true: + any two active samplers in the current program object are of different types, but refer to the same texture image unit, @@ -1555,6 +1559,8 @@ _mesa_validate_program(GLcontext *ctx, GLuint program) processing exceeds the combined limit on the total number of texture image units allowed. */ + + shProg->Validated = GL_TRUE; } -- 2.30.2