gpu: Add an internal is_clean() check

If no ops are recorded, then we don't need to wait for any ops to
finish.

Also fix the initial fence creation on Vulkan - we no longer need to
create it fixed because of the random cleanup() call at startup does no
longer happen.
This commit is contained in:
Benjamin Otte 2024-09-14 23:59:25 +02:00
parent 3286d9f1b5
commit 8f78a0f809
2 changed files with 17 additions and 1 deletions

View File

@ -95,9 +95,20 @@ gsk_gpu_frame_default_end (GskGpuFrame *self,
gdk_draw_context_end_frame_full (context);
}
static gboolean
gsk_gpu_frame_is_clean (GskGpuFrame *self)
{
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
return gsk_gpu_ops_get_size (&priv->ops) == 0;
}
static void
gsk_gpu_frame_cleanup (GskGpuFrame *self)
{
if (gsk_gpu_frame_is_clean (self))
return;
GSK_GPU_FRAME_GET_CLASS (self)->cleanup (self);
}
@ -615,12 +626,18 @@ gsk_gpu_frame_write_storage_buffer (GskGpuFrame *self,
gboolean
gsk_gpu_frame_is_busy (GskGpuFrame *self)
{
if (gsk_gpu_frame_is_clean (self))
return FALSE;
return GSK_GPU_FRAME_GET_CLASS (self)->is_busy (self);
}
void
gsk_gpu_frame_wait (GskGpuFrame *self)
{
if (gsk_gpu_frame_is_clean (self))
return;
GSK_GPU_FRAME_GET_CLASS (self)->wait (self);
}

View File

@ -115,7 +115,6 @@ gsk_vulkan_frame_setup (GskGpuFrame *frame)
GSK_VK_CHECK (vkCreateFence, vk_device,
&(VkFenceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.flags = VK_FENCE_CREATE_SIGNALED_BIT
},
NULL,
&self->vk_fence);