[gtk+/wip/otte/vulkan: 15/28] vulkan: Don't wait until graphics are done computing



commit 8e445980a3900ad69fdda60e1b47ba1d590ca15a
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 8 19:56:56 2016 +0100

    vulkan: Don't wait until graphics are done computing
    
    We can let the GPU do its stuff without waiting. The GPU knows what it's
    doing.
    
    Which means we now get a lot of time to spend on doing CPU things (read:
    we're way better in benchmarks).
    
    The old behavior is safer, so we want to keep it around for debugging.
    It can be reenabled with GSK_RENDERING_MODE=sync.

 gsk/gskdebug.c        |    2 ++
 gsk/gskdebugprivate.h |    6 ++++--
 gsk/gskvulkanrender.c |   13 ++++++++-----
 3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c
index bf82b89..02ed8b8 100644
--- a/gsk/gskdebug.c
+++ b/gsk/gskdebug.c
@@ -16,6 +16,8 @@ static const GDebugKey gsk_debug_keys[] = {
 static const GDebugKey gsk_rendering_keys[] = {
   { "geometry", GSK_RENDERING_MODE_GEOMETRY },
   { "shaders", GSK_RENDERING_MODE_SHADERS },
+  { "sync", GSK_RENDERING_MODE_SYNC },
+  { "staging-image", GSK_RENDERING_MODE_STAGING_IMAGE },
 };
 
 gboolean
diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h
index 29e529b..a5d4784 100644
--- a/gsk/gskdebugprivate.h
+++ b/gsk/gskdebugprivate.h
@@ -17,8 +17,10 @@ typedef enum {
 } GskDebugFlags;
 
 typedef enum {
-  GSK_RENDERING_MODE_GEOMETRY = 1 << 0,
-  GSK_RENDERING_MODE_SHADERS  = 1 << 1
+  GSK_RENDERING_MODE_GEOMETRY      = 1 << 0,
+  GSK_RENDERING_MODE_SHADERS       = 1 << 1,
+  GSK_RENDERING_MODE_SYNC          = 1 << 2,
+  GSK_RENDERING_MODE_STAGING_IMAGE = 1 << 3
 } GskRenderingMode;
 
 gboolean gsk_check_debug_flags (GskDebugFlags flags);
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index b645dc3..640c321 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -272,11 +272,14 @@ gsk_vulkan_render_submit (GskVulkanRender *self)
                                },
                                self->fence);
 
-  GSK_VK_CHECK (vkWaitForFences, gdk_vulkan_context_get_device (self->vulkan),
-                                 1,
-                                 &self->fence,
-                                 VK_TRUE,
-                                 INT64_MAX);
+  if (GSK_RENDER_MODE_CHECK (SYNC))
+    {
+      GSK_VK_CHECK (vkWaitForFences, gdk_vulkan_context_get_device (self->vulkan),
+                                     1,
+                                     &self->fence,
+                                     VK_TRUE,
+                                     INT64_MAX);
+    }
 }
 
 static void


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