gpu: Use the shared GL context when creating GL textures

The non-shared context's surface must survive the lifetime of the
GL texture, and when the renderer gets unrealized the surface goes away,
but we cannot guarantee that all GL textures have been destroyed by
then.

So better use a context we know will survive becuase it isn't bound to a
surface.

This is the same fix for NGL as f3ac0535f8
was for GL.
This commit is contained in:
Benjamin Otte
2024-08-23 18:59:19 +02:00
parent c2a637f68a
commit 73c94cf1d6

View File

@@ -15,6 +15,7 @@
#include <glib/gstdio.h>
#include "gdk/gdkdisplayprivate.h"
#include "gdk/gdkdmabuftexturebuilderprivate.h"
#include "gdk/gdkdmabuftextureprivate.h"
#include "gdk/gdkglcontextprivate.h"
@@ -296,7 +297,9 @@ gsk_gpu_download_op_gl_command (GskGpuOp *op,
GdkGLContext *context;
guint texture_id;
context = GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame));
/* Don't use the renderer context, the texture might survive the frame
* and its surface */
context = gdk_display_get_gl_context (gsk_gpu_device_get_display (gsk_gpu_frame_get_device (frame)));
texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
#ifdef HAVE_DMABUF