From 393ee574b68f09ec2a12bf7ec0286532be8fec55 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 11 Dec 2023 04:25:32 +0100 Subject: [PATCH] gl: Print debug for CPU conversions of textures When the GL renderer cannot upload a given format, print a FALLBACK debug message with the failed format and the alternative that was picked, for example: Unsupported format b8g8r8a8, converting on CPU to b8g8r8a8-premultiplied Makes it easier to figure out what's happening, especially when using old GLES versions that don't support all formats. --- gsk/gl/gskglcommandqueue.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index d560919f31..8c50654673 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1568,6 +1568,18 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self, &gl_type, gl_swizzle); + if (GSK_DEBUG_CHECK (FALLBACK) && + data_format != gdk_texture_get_format (texture)) + { + GEnumClass *enum_class = g_type_class_ref (GDK_TYPE_MEMORY_FORMAT); + + gdk_debug_message ("Unsupported format %s, converting on CPU to %s", + g_enum_get_value (enum_class, gdk_texture_get_format (texture))->value_nick, + g_enum_get_value (enum_class, data_format)->value_nick); + + g_type_class_unref (enum_class); + } + gdk_texture_downloader_init (&downloader, texture); gdk_texture_downloader_set_format (&downloader, data_format); bytes = gdk_texture_downloader_download_bytes (&downloader, &stride);