aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-10-14 11:32:40 +0200
committerPierre-Eric Pelloux-Prayer <[email protected]>2019-10-16 10:41:31 +0200
commit16233797f49359aadf104b5fe6bfff5b66914974 (patch)
tree615e17d178f70c41085d872c8caa51c7c9521d5f /src/mesa/main
parent268e0e01f372ccbb3501ce57084acbe18cb4a196 (diff)
mesa: fix invalid target error handling for teximage
This commit moves the target check before using _mesa_get_current_tex_object to fix a "Mesa implementation error: bad target in _mesa_get_current_tex_object()" error. Fixes: 9dd1f7cec01 ("mesa: pass gl_texture_object as arg to not depend on state") Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/teximage.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e55e435779f..b80d5a9b675 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2988,17 +2988,18 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
internalFormat = override_internal_format(internalFormat, width, height);
+ if (!no_error &&
+ /* target error checking */
+ !legal_teximage_target(ctx, dims, target)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s%uD(target=%s)",
+ func, dims, _mesa_enum_to_string(target));
+ return;
+ }
+
if (!texObj)
texObj = _mesa_get_current_tex_object(ctx, target);
if (!no_error) {
- /* target error checking */
- if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s%uD(target=%s)",
- func, dims, _mesa_enum_to_string(target));
- return;
- }
-
/* general error checking */
if (compressed) {
if (compressed_texture_error_check(ctx, dims, target, texObj,