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.
This commit is contained in:
Benjamin Otte 2023-12-11 04:25:32 +01:00
parent e3c85be53f
commit 393ee574b6

View File

@ -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);