From a3f27dfd89ee7f0ba758f831cc20eeb9e3a4cf33 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 11 Feb 2020 17:11:36 +0800 Subject: [PATCH] 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 --- 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 cee284c0c..749c9941f 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; }