mesa: fix using texture id 0 with glTextureStorage*()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 21 Jun 2017 07:56:55 +0000 (09:56 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 22 Jun 2017 08:41:19 +0000 (10:41 +0200)
This fixes an assertion in debug build, and probably a crash
in release build.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/texstorage.c

index 070d62eb834674d20f69cb40c9300f82b01bc201..958c7b7a679a2c7f930681cd15c8dd8ad55b983c 100644 (file)
@@ -539,13 +539,9 @@ texturestorage(GLuint dims, GLuint texture, GLsizei levels,
       return;
    }
 
-   /* Get the texture object by Name. */
-   texObj = _mesa_lookup_texture(ctx, texture);
-   if (!texObj) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "%s(texture = %d)", caller, texture);
+   texObj = _mesa_lookup_texture_err(ctx, texture, caller);
+   if (!texObj)
       return;
-   }
 
    /* Check target.  This is done here so that _mesa_texture_storage
     * can receive unsized formats.