[gtk/wip/chergert/fix-bgr8-uploads] gl: handle B8G8R8 texture data when uploading
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/fix-bgr8-uploads] gl: handle B8G8R8 texture data when uploading
- Date: Mon, 8 Feb 2021 23:32:31 +0000 (UTC)
commit 3a4366363042722d642b492788377407587c7886
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 8 15:30:58 2021 -0800
gl: handle B8G8R8 texture data when uploading
We do not need to translate this on the CPU when we can instead push it
to the GPU in the same format and allow it to swizzle.
This fixes a huge number of memory allocations found while uploading the
GTK animation in widget-factory.
gdk/gdkglcontext.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 5d73080b9b..3bc52b74fb 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -271,6 +271,12 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
gl_type = GL_UNSIGNED_BYTE;
bpp = 3;
}
+ else if (data_format == GDK_MEMORY_B8G8R8)
+ {
+ gl_format = GL_BGR;
+ gl_type = GL_UNSIGNED_BYTE;
+ bpp = 3;
+ }
else /* Fall-back, convert to cairo-surface-format */
{
copy = g_malloc (width * height * 4);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]