vulkan: Repurpose debug flags for image uploads
authorBenjamin Otte <otte@redhat.com>
Wed, 14 Jun 2023 01:31:11 +0000 (03:31 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 14 Jun 2023 01:34:07 +0000 (03:34 +0200)
Now that we don't use the old environment variables anymore to force
staging buffer/image uploads, we don't need them.

However, we do autodetect the fast path for avoiding a staging buffer
now, and we might want to be able to turn that off for testing.

So add GSK_DEBUG=staging that does exactly that.

gsk/gskdebug.c
gsk/gskdebugprivate.h
gsk/vulkan/gskvulkanimage.c

index f3f183c3efe23dcf84e397f9abdab40d35baf9f7..811616e6832f8145a20e2cf33125545af94cab1d 100644 (file)
@@ -15,8 +15,7 @@ static const GdkDebugKey gsk_debug_keys[] = {
   { "geometry", GSK_DEBUG_GEOMETRY, "Show borders (when using cairo)" },
   { "full-redraw", GSK_DEBUG_FULL_REDRAW, "Force full redraws" },
   { "sync", GSK_DEBUG_SYNC, "Sync after each frame" },
-  { "vulkan-staging-image", GSK_DEBUG_VULKAN_STAGING_IMAGE, "Use a staging image for Vulkan texture upload" },
-  { "vulkan-staging-buffer", GSK_DEBUG_VULKAN_STAGING_BUFFER, "Use a staging buffer for Vulkan texture upload" }
+  { "staging", GSK_DEBUG_STAGING, "Use a staging image for texture upload (Vulkan only)" },
 };
 
 static guint gsk_debug_flags;
index bb23101b34b94a4094ca25b114221b9bd13e113b..405cbd7877091164fa684dd7960f2c862c8c95a9 100644 (file)
@@ -18,8 +18,7 @@ typedef enum {
   GSK_DEBUG_GEOMETRY              = 1 <<  9,
   GSK_DEBUG_FULL_REDRAW           = 1 << 10,
   GSK_DEBUG_SYNC                  = 1 << 11,
-  GSK_DEBUG_VULKAN_STAGING_IMAGE  = 1 << 12,
-  GSK_DEBUG_VULKAN_STAGING_BUFFER = 1 << 13
+  GSK_DEBUG_STAGING               = 1 << 12
 } GskDebugFlags;
 
 #define GSK_DEBUG_ANY ((1 << 13) - 1)
index c7ec215c46f2020fd803a89183b7d550f1c76780..7e20cba9fb4c6dfcbb62d53772cf0bd5fb3ff625 100644 (file)
@@ -437,7 +437,7 @@ gsk_vulkan_image_map_memory (GskVulkanImage    *self,
   g_assert (self->vk_image_layout == VK_IMAGE_LAYOUT_UNDEFINED ||
             self->vk_image_layout == VK_IMAGE_LAYOUT_PREINITIALIZED);
 
-  if (gsk_vulkan_memory_can_map (self->memory, TRUE))
+  if (!GSK_DEBUG_CHECK (STAGING) && gsk_vulkan_memory_can_map (self->memory, TRUE))
     gsk_vulkan_image_map_memory_direct (self, uploader, map);
   else
     gsk_vulkan_image_map_memory_indirect (self, uploader, map);