diff options
author | Niklas Haas <git@haasn.xyz> | 2017-09-28 22:33:31 +0200 |
---|---|---|
committer | Martin Herkt <652892+lachs0r@users.noreply.github.com> | 2017-12-25 00:47:53 +0100 |
commit | 885497a4456256a147d9e7e30daa3170e461d7d6 (patch) | |
tree | ca0d9d08b032654aa52c326016baadebfdfe5af1 /video/out/vulkan/utils.h | |
parent | 4e34615872011f906bf653f61e7ac75d2066a06b (diff) | |
download | mpv-885497a4456256a147d9e7e30daa3170e461d7d6.tar.bz2 mpv-885497a4456256a147d9e7e30daa3170e461d7d6.tar.xz |
vo_gpu: vulkan: reorganize vk_cmd slightly
Instead of associating a single VkSemaphore with every command buffer
and allowing the user to ad-hoc wait on it during submission, make the
raw semaphores-to-signal array work like the raw semaphores-to-wait-on
array. Doesn't really provide a clear benefit yet, but it's required for
upcoming modifications.
Diffstat (limited to 'video/out/vulkan/utils.h')
-rw-r--r-- | video/out/vulkan/utils.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/video/out/vulkan/utils.h b/video/out/vulkan/utils.h index 36a0e3c5d0..3ade92d6a0 100644 --- a/video/out/vulkan/utils.h +++ b/video/out/vulkan/utils.h @@ -93,12 +93,15 @@ struct vk_cmd { VkQueue queue; // the submission queue (for recording/pending) VkCommandBuffer buf; // the command buffer itself VkFence fence; // the fence guards cmd buffer reuse - VkSemaphore done; // the semaphore signals when execution is done // The semaphores represent dependencies that need to complete before // this command can be executed. These are *not* owned by the vk_cmd VkSemaphore *deps; VkPipelineStageFlags *depstages; int num_deps; + // The signals represent semaphores that fire once the command finishes + // executing. These are also not owned by the vk_cmd + VkSemaphore *sigs; + int num_sigs; // Since VkFences are useless, we have to manually track "callbacks" // to fire once the VkFence completes. These are used for multiple purposes, // ranging from garbage collection (resource deallocation) to fencing. @@ -110,10 +113,13 @@ struct vk_cmd { // bool will be set to `true` once the command completes, or shortly thereafter. void vk_cmd_callback(struct vk_cmd *cmd, vk_cb callback, void *p, void *arg); -// Associate a dependency for the current command. This semaphore must signal -// by the corresponding stage before the command may execute. -void vk_cmd_dep(struct vk_cmd *cmd, VkSemaphore dep, - VkPipelineStageFlags depstage); +// Associate a raw dependency for the current command. This semaphore must +// signal by the corresponding stage before the command may execute. +void vk_cmd_dep(struct vk_cmd *cmd, VkSemaphore dep, VkPipelineStageFlags stage); + +// Associate a raw signal with the current command. This semaphore will signal +// after the command completes. +void vk_cmd_sig(struct vk_cmd *cmd, VkSemaphore sig); // Command pool / queue family hybrid abstraction struct vk_cmdpool { @@ -136,10 +142,8 @@ struct vk_cmd *vk_cmd_begin(struct mpvk_ctx *vk, struct vk_cmdpool *pool); // Finish recording a command buffer and submit it for execution. This function // takes over ownership of *cmd, i.e. the caller should not touch it again. -// If `done` is not NULL, it will be set to a semaphore that will signal once -// the command completes. // Returns whether successful. -bool vk_cmd_submit(struct mpvk_ctx *vk, struct vk_cmd *cmd, VkSemaphore *done); +bool vk_cmd_submit(struct mpvk_ctx *vk, struct vk_cmd *cmd); // Rotate the queues for each vk_cmdpool. Call this once per frame to ensure // good parallelism between frames when using multiple queues |