summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-04-27 09:49:41 +0200
committerTimm Bäder <mail@baedert.org>2019-04-27 10:44:23 +0200
commit6f3e6083314b39d759871e59212ce41ea64c173b (patch)
treeb1002c32355c4ad1ff4553cec588fe2a5f42ac2d /gdk
parentcc4b3798e53a3efc63c14b98d3f70488801a70a1 (diff)
downloadgtk+-6f3e6083314b39d759871e59212ce41ea64c173b.tar.gz
gdkglcontext: Limit gl debug label length
There's a maximum length we have to adhere to, otherwise GL throws a GL_INVALID_VALUE error.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkglcontext.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 3f93d83f42..b36b721f49 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -116,6 +116,8 @@ typedef struct {
int use_es;
+ int max_debug_label_length;
+
GdkGLContextPaintData *paint_data;
} GdkGLContextPrivate;
@@ -457,11 +459,14 @@ gdk_gl_context_push_debug_group_printf (GdkGLContext *context,
if (priv->use_khr_debug)
{
+ int msg_len;
+
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
- glPushDebugGroupKHR (GL_DEBUG_SOURCE_APPLICATION, 0, -1, message);
+ msg_len = MIN (priv->max_debug_label_length, strlen (message) - 1);
+ glPushDebugGroupKHR (GL_DEBUG_SOURCE_APPLICATION, 0, msg_len, message);
g_free (message);
}
}
@@ -500,11 +505,15 @@ gdk_gl_context_label_object_printf (GdkGLContext *context,
if (priv->use_khr_debug)
{
+ int msg_len;
+
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
- glObjectLabel (identifier, name, -1, message);
+ msg_len = MIN (priv->max_debug_label_length, strlen (message) - 1);
+
+ glObjectLabel (identifier, name, msg_len, message);
g_free (message);
}
}
@@ -992,7 +1001,10 @@ 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;
+ {
+ priv->use_khr_debug = TRUE;
+ glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
+ }
if (!priv->use_es && GDK_DISPLAY_DEBUG_CHECK (display, GL_TEXTURE_RECT))
priv->use_texture_rectangle = TRUE;
else if (has_npot)