gdk: Use the new debug macros

This commit is contained in:
Matthias Clasen 2022-09-22 20:48:58 -04:00
parent 10255eee72
commit 1d48f96fc5
6 changed files with 59 additions and 53 deletions

View File

@ -1729,11 +1729,13 @@ gdk_display_init_egl (GdkDisplay *self,
if (priv->egl_config_high_depth == NULL)
priv->egl_config_high_depth = priv->egl_config;
GDK_DISPLAY_NOTE (self, OPENGL, {
#ifdef G_ENABLE_DEBUG
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
{
char *ext = describe_extensions (priv->egl_display);
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
g_message ("EGL API version %d.%d found\n"
gdk_debug_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
@ -1750,7 +1752,8 @@ gdk_display_init_egl (GdkDisplay *self,
g_free (hd_cfg);
g_free (std_cfg);
g_free (ext);
});
}
#endif
gdk_profiler_end_mark (start_time, "init EGL", NULL);

View File

@ -420,7 +420,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
g_str_equal (backend, gdk_backends[j].name))
{
GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name));
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
display = gdk_backends[j].open_display (name);
if (display)
break;

View File

@ -402,12 +402,15 @@ gdk_event_alloc (GdkEventType event_type,
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
GDK_NOTE (EVENTS, {
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (EVENTS))
{
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
g_message ("Allocating a new %s for event type %s",
gdk_debug_message ("Allocating a new %s for event type %s",
g_type_name (gdk_event_types[event_type]), str);
g_free (str);
});
}
#endif
event->event_type = event_type;
event->surface = surface != NULL ? g_object_ref (surface) : NULL;

View File

@ -193,7 +193,7 @@ gdk_gl_context_dispose (GObject *gobject)
if (eglGetCurrentContext () == priv->egl_context)
eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying EGL context"));
GDK_DISPLAY_DEBUG (display, OPENGL, "Destroying EGL context");
eglDestroyContext (egl_display, priv->egl_context);
priv->egl_context = NULL;
@ -339,13 +339,13 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
GDK_DISPLAY_DEBUG (display, OPENGL,
"Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
forward_bit ? "yes" : "no",
legacy ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no"));
api == GDK_GL_API_GLES ? "yes" : "no");
ctx = eglCreateContext (egl_display,
egl_config,
@ -355,7 +355,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
if (ctx == NULL)
return 0;
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx);
priv->egl_context = ctx;
gdk_gl_context_set_is_legacy (context, legacy);
@ -1533,8 +1533,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
epoxy_has_gl_extension ("OES_vertex_half_float");
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
g_message ("%s version: %d.%d (%s)\n"
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
"%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
@ -1546,7 +1546,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
glGetString (GL_SHADING_LANGUAGE_VERSION),
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no"));
priv->has_half_float ? "yes" : "no");
priv->extensions_checked = TRUE;
}
@ -1836,8 +1836,8 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
the_gl_backend_type = backend_type;
/* This is important!!!11eleven
* (But really: How do I print a message in 2 categories?) */
GDK_NOTE (OPENGL, g_print ("Using OpenGL backend %s\n", gl_backend_names[the_gl_backend_type]));
GDK_NOTE (MISC, g_message ("Using Opengl backend %s", gl_backend_names[the_gl_backend_type]));
GDK_DEBUG (OPENGL, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]);
GDK_DEBUG (MISC, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]);
}
g_assert (the_gl_backend_type == backend_type);

View File

@ -309,8 +309,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
}
else
{
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)),
VULKAN, g_warning ("Vulkan swapchain doesn't do transparency. Using opaque swapchain instead."));
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), VULKAN,
"Vulkan swapchain doesn't do transparency. Using opaque swapchain instead.");
composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
}
@ -950,7 +950,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
if (has_incremental_present)
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
GDK_DISPLAY_NOTE (display, VULKAN, g_print ("Using Vulkan device %u, queue %u\n", i, j));
GDK_DISPLAY_DEBUG (display, VULKAN, "Using Vulkan device %u, queue %u", i, j);
if (GDK_VK_CHECK (vkCreateDevice, devices[i],
&(VkDeviceCreateInfo) {
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,

View File

@ -62,7 +62,7 @@ gdk_vulkan_handle_result (VkResult res,
{
if (res != VK_SUCCESS)
{
GDK_NOTE (VULKAN, g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res));
GDK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
}
return res;
@ -81,7 +81,7 @@ static inline gboolean
gdk_display_ref_vulkan (GdkDisplay *display,
GError **error)
{
GDK_DISPLAY_NOTE (display, VULKAN, g_message ("Support for Vulkan disabled at compile-time"));
GDK_DISPLAY_DEBUG (display, VULKAN, "Support for Vulkan disabled at compile-time");
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
"Vulkan support was not enabled at compile time.");