aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-04 15:58:11 +0100
committerSimon Ser <contact@emersion.fr>2022-11-11 19:18:04 +0000
commita8a194d695af9df4761bd894174134704ae7cebb (patch)
tree680f2a35b6fcac3f80a1a7f8fdeae0e30ad88c5c /include
parentf92d1499cd8582949a3c08edbf3db7d4a4471360 (diff)
render/vulkan: switch to timeline semaphores
Up until now we were using a VkFence for GPU-to-CPU synchronization. This has some limitations that become a blocker when trying to have multiple command buffers in flight at once (e.g. for multi-output). It's desirable to implement a command buffer pool [1], but VkFence cannot be used to track command buffer completion for individual subpasses. Let's just switch to timeline semaphores [2], which fix this issue, make synchronization a lot more ergonomic and are a core Vulkan 1.2 feature. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3802 [2]: https://www.khronos.org/blog/vulkan-timeline-semaphores
Diffstat (limited to 'include')
-rw-r--r--include/render/vulkan.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h
index 74df5a75..a22d224f 100644
--- a/include/render/vulkan.h
+++ b/include/render/vulkan.h
@@ -44,6 +44,7 @@ struct wlr_vk_device {
struct {
PFN_vkGetMemoryFdPropertiesKHR getMemoryFdPropertiesKHR;
+ PFN_vkWaitSemaphoresKHR waitSemaphoresKHR;
} api;
uint32_t format_prop_count;
@@ -151,7 +152,8 @@ struct wlr_vk_renderer {
VkPipelineLayout pipe_layout;
VkSampler sampler;
- VkFence fence;
+ VkSemaphore timeline_semaphore;
+ uint64_t timeline_point;
struct wlr_vk_render_buffer *current_render_buffer;