[gtk/wip/chergert/glproto: 734/920] debug atlas content after uploads but before commands




commit ac2f66bc204919033c88e661919590ad06be4447
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 20 20:51:35 2021 -0800

    debug atlas content after uploads but before commands

 gsk/next/gskgldriver.c        | 34 ++++++++++++++++++++++------------
 gsk/next/gskgldriverprivate.h |  2 ++
 gsk/next/gskglrenderjob.c     |  7 +++++++
 3 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/gsk/next/gskgldriver.c b/gsk/next/gskgldriver.c
index 4be198cebe..409414e14e 100644
--- a/gsk/next/gskgldriver.c
+++ b/gsk/next/gskgldriver.c
@@ -465,18 +465,6 @@ gsk_next_driver_end_frame (GskNextDriver *self)
 
   gdk_gl_context_make_current (self->command_queue->context);
 
-#if 0
-  /* Dump all the texture atlases for exploration */
-  for (guint i = 0; i < self->atlases->len; i++)
-    {
-      GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
-      char *filename = g_strdup_printf ("frame-%d-atlas-%d.png",
-                                        (int)self->current_frame_id,
-                                        atlas->texture_id);
-      write_atlas_to_png (atlas, filename);
-    }
-#endif
-
   gsk_gl_command_queue_end_frame (self->command_queue);
 
   gsk_gl_texture_library_end_frame (GSK_GL_TEXTURE_LIBRARY (self->icons));
@@ -1017,3 +1005,25 @@ gsk_next_driver_lookup_shader (GskNextDriver  *self,
 
   return g_steal_pointer (&program);
 }
+
+void
+gsk_next_driver_save_atlases_to_png (GskNextDriver *self,
+                                     const char    *directory)
+{
+  g_return_if_fail (GSK_IS_NEXT_DRIVER (self));
+
+  if (directory == NULL)
+    directory = ".";
+
+  for (guint i = 0; i < self->atlases->len; i++)
+    {
+      GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
+      char *filename = g_strdup_printf ("%s%sframe-%d-atlas-%d.png",
+                                        directory,
+                                        G_DIR_SEPARATOR_S,
+                                        (int)self->current_frame_id,
+                                        atlas->texture_id);
+      write_atlas_to_png (atlas, filename);
+      g_free (filename);
+    }
+}
diff --git a/gsk/next/gskgldriverprivate.h b/gsk/next/gskgldriverprivate.h
index 120409d509..c73181bb27 100644
--- a/gsk/next/gskgldriverprivate.h
+++ b/gsk/next/gskgldriverprivate.h
@@ -156,6 +156,8 @@ GskGLProgram      *gsk_next_driver_lookup_shader         (GskNextDriver        *
                                                           GskGLShader          *shader,
                                                           GError              **error);
 GskGLTextureAtlas *gsk_next_driver_create_atlas          (GskNextDriver        *self);
+void              gsk_next_driver_save_atlases_to_png    (GskNextDriver        *self,
+                                                          const char           *directory);
 
 G_END_DECLS
 
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 21ce9f30ed..8bc345f12f 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -3539,6 +3539,13 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
   gsk_gl_render_job_visit_node (job, root);
   gdk_gl_context_pop_debug_group (context);
 
+#if 0
+  /* At this point the atlases have uploaded content while we processed
+   * nodes but have not necessarily been used by the commands in the queue.
+   */
+  gsk_next_driver_save_atlases_to_png (job->driver, NULL);
+#endif
+
   gdk_gl_context_push_debug_group (context, "Executing command queue");
   gsk_gl_command_queue_execute (job->command_queue);
   gdk_gl_context_pop_debug_group (context);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]