vulkan: Repurpose debug flags for image uploads

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.
This commit is contained in:
Benjamin Otte 2023-06-14 03:31:11 +02:00
parent 7f26f5a160
commit 9836389fde
3 changed files with 3 additions and 5 deletions

View 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;

View 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)

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