diff options
author | Brian Paul <[email protected]> | 2015-09-30 11:37:16 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-10-01 07:45:43 -0600 |
commit | a9408f3ca14f2fb6286bd66bad06ee1bde0d8697 (patch) | |
tree | 362fe0363b48d24dbe95b55d5fba4587470136c9 /src/mesa/main/texobj.c | |
parent | c277fa394087272c79d65fc308d268fc768b91e5 (diff) |
mesa: remove _mesa_get_tex_unit_err() and fix error handling
This helper was only called from _mesa_BindTextureUnit(). It's simpler
to just inline it.
The error check / code / message in the helper was incorrect. It was
written for glBindTextures(), not glBindTextureUnit(). The correct
error for a bad texture unit number is GL_INVALID_VALUE. The error
message now reports the unit number rather than a GL_TEXTUREi enum.
Fixes a failure in piglit's arb_direct_state_access-bind-texture-unit test.
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d7654eba51a..105ec1eab93 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1780,8 +1780,13 @@ _mesa_BindTextureUnit(GLuint unit, GLuint texture) struct gl_texture_object *texObj; struct gl_texture_unit *texUnit; - /* Get the texture unit (this is an array look-up) */ - texUnit = _mesa_get_tex_unit_err(ctx, unit, "glBindTextureUnit"); + if (unit >= _mesa_max_tex_unit(ctx)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindTextureUnit(unit=%u)", unit); + return; + } + + texUnit = _mesa_get_tex_unit(ctx, unit); + assert(texUnit); if (!texUnit) { return; } |