aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/vulkan/utils.h
diff options
context:
space:
mode:
authorGravatar Niklas Haas <git@haasn.xyz>2017-09-28 23:06:56 +0200
committerGravatar Martin Herkt <652892+lachs0r@users.noreply.github.com>2017-12-25 00:47:53 +0100
commit5feaaba0fd27af34ee1fef12545f1dd96ebefddd (patch)
treecd6278cc8f8de6e2f9f66a1d8ab6c06281ad77f5 /video/out/vulkan/utils.h
parent885497a4456256a147d9e7e30daa3170e461d7d6 (diff)
vo_gpu: vulkan: refactor command submission
Instead of being submitted immediately, commands are appended into an internal submission queue, and the actual submission is done once per frame (at the same time as queue cycling). Again, the benefits are not immediately obvious because nothing benefits from this yet, but it will make more sense for an upcoming vk_signal mechanism. This also cleans up the way the ra_vk submission interacts with the synchronization/callbacks from the ra_vk_ctx. Although currently, the way the dependency is signalled is a bit hacky: normally it would be associated with the ra_tex itself and waited on in the appropriate stage implicitly. But that code is just temporary, so I'm keeping it in there for a better commit order.
Diffstat (limited to 'video/out/vulkan/utils.h')
-rw-r--r--video/out/vulkan/utils.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/video/out/vulkan/utils.h b/video/out/vulkan/utils.h
index 3ade92d6a0..bdbbe0aa70 100644
--- a/video/out/vulkan/utils.h
+++ b/video/out/vulkan/utils.h
@@ -131,8 +131,10 @@ struct vk_cmdpool {
int idx_queues;
// Command buffers associated with this queue
struct vk_cmd **cmds_available; // available for re-recording
+ struct vk_cmd **cmds_queued; // recorded but not yet submitted
struct vk_cmd **cmds_pending; // submitted but not completed
int num_cmds_available;
+ int num_cmds_queued;
int num_cmds_pending;
};
@@ -140,14 +142,15 @@ struct vk_cmdpool {
// Returns NULL on failure.
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
+// Finish recording a command buffer and queue it for execution. This function
// takes over ownership of *cmd, i.e. the caller should not touch it again.
-// Returns whether successful.
-bool vk_cmd_submit(struct mpvk_ctx *vk, struct vk_cmd *cmd);
+void vk_cmd_queue(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
-void vk_cmd_cycle_queues(struct mpvk_ctx *vk);
+// Flush all currently queued commands. Call this once per frame, after
+// submitting all of the command buffers for that frame. Calling this more
+// often than that is possible but bad for performance.
+// Returns whether successful. Failed commands will be implicitly dropped.
+bool vk_flush_commands(struct mpvk_ctx *vk);
// Predefined structs for a simple non-layered, non-mipped image
extern const VkImageSubresourceRange vk_range;