[mutter/gnome-3-36] cogl: Ensure GL_TEXTURE_MAX_LEVEL is set before using it



commit 55bfea245bf0f78f087aa489e6cb0bd07f7e6856
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Tue Feb 11 17:11:36 2020 +0800

    cogl: Ensure GL_TEXTURE_MAX_LEVEL is set before using it
    
    Just in case it was lower before. So that `upload_subregion_to_gl` is
    not trying to upload to a disallowed mipmap level.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/1003
    
    (cherry picked from commit a3f27dfd89ee7f0ba758f831cc20eeb9e3a4cf33)

 cogl/cogl/driver/gl/cogl-texture-2d-gl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c
index cee284c0ca..749c9941fc 100644
--- a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c
+++ b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c
@@ -567,6 +567,8 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
                                           &gl_format,
                                           &gl_type);
 
+  _cogl_texture_gl_maybe_update_max_level (tex, level);
+
   status = ctx->texture_driver->upload_subregion_to_gl (ctx,
                                                         tex,
                                                         src_x, src_y,
@@ -580,8 +582,6 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
 
   cogl_object_unref (upload_bmp);
 
-  _cogl_texture_gl_maybe_update_max_level (tex, level);
-
   return status;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]