[gtk/wip/baedert/fix-gl-debug: 1/2] gdkglcontext: Limit gl debug label length
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/fix-gl-debug: 1/2] gdkglcontext: Limit gl debug label length
- Date: Sat, 27 Apr 2019 08:45:56 +0000 (UTC)
commit 6f3e6083314b39d759871e59212ce41ea64c173b
Author: Timm Bäder <mail baedert org>
Date: Sat Apr 27 09:49:41 2019 +0200
gdkglcontext: Limit gl debug label length
There's a maximum length we have to adhere to, otherwise GL throws a
GL_INVALID_VALUE error.
gdk/gdkglcontext.c | 18 +++++++++++++++---
1 file 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]