mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
gdkglcontext: Only emit opengl debug calls if GDK_DEBUG=gl-debug
This avoids a potential performance cost in the non-debug case.
This commit is contained in:
parent
32edf29c0a
commit
249f6a85b3
@ -145,6 +145,7 @@ static const GDebugKey gdk_debug_keys[] = {
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE }
|
||||
};
|
||||
|
@ -106,6 +106,7 @@ typedef struct {
|
||||
guint has_gl_framebuffer_blit : 1;
|
||||
guint has_frame_terminator : 1;
|
||||
guint has_khr_debug : 1;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_unpack_subimage : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint extensions_checked : 1;
|
||||
@ -441,7 +442,7 @@ gdk_gl_context_push_debug_group (GdkGLContext *context,
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
if (priv->has_khr_debug)
|
||||
if (priv->use_khr_debug)
|
||||
glPushDebugGroupKHR (GL_DEBUG_SOURCE_APPLICATION, 0, -1, message);
|
||||
}
|
||||
|
||||
@ -454,7 +455,7 @@ gdk_gl_context_push_debug_group_printf (GdkGLContext *context,
|
||||
gchar *message;
|
||||
va_list args;
|
||||
|
||||
if (priv->has_khr_debug)
|
||||
if (priv->use_khr_debug)
|
||||
{
|
||||
va_start (args, format);
|
||||
message = g_strdup_vprintf (format, args);
|
||||
@ -470,7 +471,7 @@ gdk_gl_context_pop_debug_group (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
if (priv->has_khr_debug)
|
||||
if (priv->use_khr_debug)
|
||||
glPopDebugGroupKHR ();
|
||||
}
|
||||
|
||||
@ -482,7 +483,7 @@ gdk_gl_context_label_object (GdkGLContext *context,
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
if (priv->has_khr_debug)
|
||||
if (priv->use_khr_debug)
|
||||
glObjectLabel (identifier, name, -1, label);
|
||||
}
|
||||
|
||||
@ -497,7 +498,7 @@ gdk_gl_context_label_object_printf (GdkGLContext *context,
|
||||
gchar *message;
|
||||
va_list args;
|
||||
|
||||
if (priv->has_khr_debug)
|
||||
if (priv->use_khr_debug)
|
||||
{
|
||||
va_start (args, format);
|
||||
message = g_strdup_vprintf (format, args);
|
||||
@ -990,6 +991,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
|
||||
if (priv->has_khr_debug && GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG))
|
||||
priv->use_khr_debug = TRUE;
|
||||
if (!priv->use_es && GDK_DISPLAY_DEBUG_CHECK (display, GL_TEXTURE_RECT))
|
||||
priv->use_texture_rectangle = TRUE;
|
||||
else if (has_npot)
|
||||
|
@ -63,8 +63,9 @@ typedef enum {
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 15,
|
||||
GDK_DEBUG_GL_GLES = 1 << 16,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 17,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 18
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 17,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 18,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 19
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
Loading…
Reference in New Issue
Block a user