diff options
author | Ian Romanick <[email protected]> | 2011-10-11 16:55:54 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2011-11-07 13:33:15 -0800 |
commit | fa7eccb8c0c590535856a54e3697982af6a630ed (patch) | |
tree | 523c2198b4634d7d079b94171443bc592a234251 /src/mesa | |
parent | f6ee7bce65697ea3c6a78a000a49af901ba77c1d (diff) |
mesa: Move the link check from _mesa_get_uniform_location to _mesa_GetUniformLocationARB
There are cases where we might want to internally query the location
of a uniform in a shader that failed linking.
Signed-off-by: Ian Romanick <[email protected]>
Tested-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/uniforms.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 68e44b27244..6403137756a 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -491,11 +491,6 @@ _mesa_get_uniform_location(struct gl_context *ctx, { GLint offset = 0, location = -1; - if (shProg->LinkStatus == GL_FALSE) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)"); - return -1; - } - /* XXX we should return -1 if the uniform was declared, but not * actually used. */ @@ -1428,6 +1423,17 @@ _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name) if (!shProg) return -1; + /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says: + * + * "If program has not been successfully linked, the error + * INVALID_OPERATION is generated." + */ + if (shProg->LinkStatus == GL_FALSE) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetUniformLocation(program not linked)"); + return -1; + } + return _mesa_get_uniform_location(ctx, shProg, name); } |