Mesa (master): mesa: fix assertion failure in TexImage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 22 22:09:18 UTC 2019


Module: Mesa
Branch: master
Commit: c37df5feaa267080b836bbcf0f2727ec9f1d288e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c37df5feaa267080b836bbcf0f2727ec9f1d288e

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jul 22 15:28:42 2019 -0400

mesa: fix assertion failure in TexImage

Check the assertion after error checking.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111194

Fixes: 9dd1f7cec01 ("mesa: pass gl_texture_object as arg to not depend on state")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/teximage.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 87187c2b7fb..7f91ea490fb 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2979,6 +2979,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
 
    internalFormat = override_internal_format(internalFormat, width, height);
 
+   if (!texObj)
+      texObj = _mesa_get_current_tex_object(ctx, target);
+
    if (!no_error) {
       /* target error checking */
       if (!legal_teximage_target(ctx, dims, target)) {
@@ -3001,6 +3004,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
             return;
       }
    }
+   assert(texObj);
 
    /* Here we convert a cpal compressed image into a regular glTexImage2D
     * call by decompressing the texture.  If we really want to support cpal
@@ -3160,10 +3164,7 @@ teximage_err(struct gl_context *ctx, GLboolean compressed, GLuint dims,
              GLint border, GLenum format, GLenum type,
              GLsizei imageSize, const GLvoid *pixels)
 {
-   struct gl_texture_object* texObj = _mesa_get_current_tex_object(ctx, target);
-   assert(texObj);
-
-   teximage(ctx, compressed, dims, texObj, target, level, internalFormat, width, height,
+   teximage(ctx, compressed, dims, NULL, target, level, internalFormat, width, height,
             depth, border, format, type, imageSize, pixels, false);
 }
 
@@ -3175,10 +3176,7 @@ teximage_no_error(struct gl_context *ctx, GLboolean compressed, GLuint dims,
                   GLint border, GLenum format, GLenum type,
                   GLsizei imageSize, const GLvoid *pixels)
 {
-   struct gl_texture_object* texObj = _mesa_get_current_tex_object(ctx, target);
-   assert(texObj);
-
-   teximage(ctx, compressed, dims, texObj, target, level, internalFormat, width, height,
+   teximage(ctx, compressed, dims, NULL, target, level, internalFormat, width, height,
             depth, border, format, type, imageSize, pixels, true);
 }
 




More information about the mesa-commit mailing list