[gtk/wip/alexl/gl-debug: 18/18] gdkglcontext: Only emit opengl debug calls if GDK_DEBUG=gl-debug
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/alexl/gl-debug: 18/18] gdkglcontext: Only emit opengl debug calls if GDK_DEBUG=gl-debug
- Date: Thu, 25 Apr 2019 09:40:54 +0000 (UTC)
commit 249f6a85b3d349194e856f87e43ae5b7a399fd57
Author: Alexander Larsson <alexl redhat com>
Date: Wed Apr 24 15:23:32 2019 +0200
gdkglcontext: Only emit opengl debug calls if GDK_DEBUG=gl-debug
This avoids a potential performance cost in the non-debug case.
gdk/gdk.c | 1 +
gdk/gdkglcontext.c | 13 ++++++++-----
gdk/gdkinternals.h | 5 +++--
3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index e094b3465a..29acab5415 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -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 }
};
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 9ac8628ca0..3f93d83f42 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -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)
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 35b5cccedd..3e0cc5be9a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]