Merge branch 'wip/baedert/fix-gl-debug' into 'master'

Fix GL debugging

See merge request GNOME/gtk!778
This commit is contained in:
Alexander Larsson 2019-04-29 11:42:04 +00:00
commit 484e330e4a
3 changed files with 25 additions and 12 deletions

View File

@ -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;
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)

View File

@ -535,8 +535,6 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *self,
}
t = create_texture (self, gdk_texture_get_width (texture), gdk_texture_get_height (texture));
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, t->texture_id,
"GdkTexture<%p> %d", texture, t->texture_id);
if (gdk_texture_set_render_data (texture, self, t, gsk_gl_driver_release_texture))
t->user = texture;
@ -547,6 +545,9 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *self,
surface,
min_filter,
mag_filter);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, t->texture_id,
"GdkTexture<%p> %d", texture, t->texture_id);
cairo_surface_destroy (surface);
return t->texture_id;

View File

@ -480,14 +480,14 @@ render_fallback_node (GskGLRenderer *self,
texture_id = gsk_gl_driver_create_texture (self->gl_driver,
surface_width,
surface_height);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
"Fallback %s %d", node->node_class->type_name, texture_id);
gsk_gl_driver_bind_source_texture (self->gl_driver, texture_id);
gsk_gl_driver_init_texture_with_surface (self->gl_driver,
texture_id,
surface,
GL_NEAREST, GL_NEAREST);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
"Fallback %s %d", node->node_class->type_name, texture_id);
cairo_surface_destroy (surface);
@ -1432,10 +1432,10 @@ render_outset_shadow_node (GskGLRenderer *self,
GskRoundedRect blit_clip;
texture_id = gsk_gl_driver_create_texture (self->gl_driver, texture_width, texture_height);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
"Outset Shadow Temp %d", texture_id);
gsk_gl_driver_bind_source_texture (self->gl_driver, texture_id);
gsk_gl_driver_init_texture_empty (self->gl_driver, texture_id);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, texture_id,
"Outset Shadow Temp %d", texture_id);
render_target = gsk_gl_driver_create_render_target (self->gl_driver, texture_id, FALSE, FALSE);
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, render_target,
"Outset Shadow FB Temp %d", render_target);
@ -1469,10 +1469,10 @@ render_outset_shadow_node (GskGLRenderer *self,
});
blurred_texture_id = gsk_gl_driver_create_permanent_texture (self->gl_driver, texture_width, texture_height);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, blurred_texture_id,
"Outset Shadow Cache %d", blurred_texture_id);
gsk_gl_driver_bind_source_texture (self->gl_driver, blurred_texture_id);
gsk_gl_driver_init_texture_empty (self->gl_driver, blurred_texture_id);
gdk_gl_context_label_object_printf (self->gl_context, GL_TEXTURE, blurred_texture_id,
"Outset Shadow Cache %d", blurred_texture_id);
blurred_render_target = gsk_gl_driver_create_render_target (self->gl_driver, blurred_texture_id, TRUE, TRUE);
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, render_target,
"Outset Shadow Cache FB %d", render_target);