[gtk+] gsk: Add debug category for fallbacks



commit b11b7dfb1a359da8863918ec2545a64bbbb3b22d
Author: Benjamin Otte <otte redhat com>
Date:   Sat Dec 24 00:52:07 2016 +0100

    gsk: Add debug category for fallbacks
    
    ... and use it for the cases in Vulkan where we fall back to Cairo.

 gsk/gskdebug.c            |    3 ++-
 gsk/gskdebugprivate.h     |    3 ++-
 gsk/gskvulkanrenderpass.c |   21 ++++++++++++++-------
 3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c
index 7ee7a7b..3ccb5e0 100644
--- a/gsk/gskdebug.c
+++ b/gsk/gskdebug.c
@@ -9,7 +9,8 @@ static const GDebugKey gsk_debug_keys[] = {
   { "shaders", GSK_DEBUG_SHADERS },
   { "transforms", GSK_DEBUG_TRANSFORMS },
   { "surface", GSK_DEBUG_SURFACE },
-  { "vulkan", GSK_DEBUG_VULKAN }
+  { "vulkan", GSK_DEBUG_VULKAN },
+  { "fallback", GSK_DEBUG_FALLBACK }
 };
 #endif
 
diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h
index 6f5d64e..26b24f7 100644
--- a/gsk/gskdebugprivate.h
+++ b/gsk/gskdebugprivate.h
@@ -13,7 +13,8 @@ typedef enum {
   GSK_DEBUG_SHADERS     = 1 << 4,
   GSK_DEBUG_TRANSFORMS  = 1 << 5,
   GSK_DEBUG_SURFACE     = 1 << 6,
-  GSK_DEBUG_VULKAN      = 1 << 7
+  GSK_DEBUG_VULKAN      = 1 << 7,
+  GSK_DEBUG_FALLBACK    = 1 << 8
 } GskDebugFlags;
 
 typedef enum {
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index a7ba94d..8a74cf7 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -2,6 +2,7 @@
 
 #include "gskvulkanrenderpassprivate.h"
 
+#include "gskdebugprivate.h"
 #include "gskrendernodeprivate.h"
 #include "gskrenderer.h"
 #include "gskroundedrectprivate.h"
@@ -82,6 +83,11 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
   g_slice_free (GskVulkanRenderPass, self);
 }
 
+#define FALLBACK(...) G_STMT_START { \
+  GSK_NOTE (FALLBACK, g_print (__VA_ARGS__)); \
+  goto fallback; \
+}G_STMT_END
+
 void
 gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
                                  GskVulkanRender               *render,
@@ -100,13 +106,13 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
       g_assert_not_reached ();
       return;
     default:
-      goto fallback;
+      FALLBACK ("Unsupported node '%s'\n", node->node_class->type_name);
 
     case GSK_CAIRO_NODE:
       if (gsk_cairo_node_get_surface (node) == NULL)
         return;
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Cairo nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_SURFACE;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
       g_array_append_val (self->render_ops, op);
@@ -114,7 +120,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
 
     case GSK_TEXTURE_NODE:
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Texture nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_TEXTURE;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
       g_array_append_val (self->render_ops, op);
@@ -122,7 +128,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
 
     case GSK_COLOR_NODE:
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Color nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_COLOR;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_COLOR);
       g_array_append_val (self->render_ops, op);
@@ -146,7 +152,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         graphene_rect_t rect;
 
         if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-          goto fallback;
+          FALLBACK ("Transform nodes can't deal with clip type %u\n", clip->type);
 
         gsk_transform_node_get_transform (node, &transform);
         op.type = GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS;
@@ -168,7 +174,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         GskVulkanClip new_clip;
 
         if (!gsk_vulkan_clip_intersect_rect (&new_clip, clip, gsk_clip_node_peek_clip (node)))
-          goto fallback;
+          FALLBACK ("Failed to find intersection between clip of type %u and rectangle\n", clip->type);
         if (new_clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
@@ -181,7 +187,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         GskVulkanClip new_clip;
 
         if (!gsk_vulkan_clip_intersect_rounded_rect (&new_clip, clip, gsk_rounded_clip_node_peek_clip 
(node)))
-          goto fallback;
+          FALLBACK ("Failed to find intersection between clip of type %u and rounded rectangle\n", 
clip->type);
         if (new_clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
@@ -216,6 +222,7 @@ fallback:
   op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
   g_array_append_val (self->render_ops, op);
 }
+#undef FALLBACK
 
 void
 gsk_vulkan_render_pass_add (GskVulkanRenderPass     *self,


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