vulkan: Add a common vkResetCommandBuffer() implementation
authorJason Ekstrand <jason.ekstrand@collabora.com>
Tue, 30 Aug 2022 16:30:10 +0000 (11:30 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 20:17:25 +0000 (20:17 +0000)
This is little more than a wrapper around a function pointer at present
so it doesn't really gain the driver much to use it.  The new callback
will, however, be put to good use in the next commit.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>

src/vulkan/runtime/vk_command_buffer.c
src/vulkan/runtime/vk_command_buffer.h

index 9d291f9..2bccf6c 100644 (file)
@@ -72,6 +72,17 @@ vk_command_buffer_finish(struct vk_command_buffer *command_buffer)
    vk_object_base_finish(&command_buffer->base);
 }
 
+VKAPI_ATTR VkResult VKAPI_CALL
+vk_common_ResetCommandBuffer(VkCommandBuffer commandBuffer,
+                             VkCommandBufferResetFlags flags)
+{
+   VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
+
+   cmd_buffer->ops->reset(cmd_buffer, flags);
+
+   return VK_SUCCESS;
+}
+
 VKAPI_ATTR void VKAPI_CALL
 vk_common_CmdExecuteCommands(VkCommandBuffer commandBuffer,
                              uint32_t commandBufferCount,
index afda24b..95c0259 100644 (file)
@@ -60,6 +60,15 @@ struct vk_attachment_state {
 };
 
 struct vk_command_buffer_ops {
+   /** Resets the command buffer
+    *
+    * Used by the common command pool implementation.  This function MUST
+    * call `vk_command_buffer_reset()`.  Unlike `vkResetCommandBuffer()`,
+    * this function does not have a return value because it may be called on
+    * destruction paths.
+    */
+   void (*reset)(struct vk_command_buffer *, VkCommandBufferResetFlags);
+
    /** Destroys the command buffer
     *
     * Used by the common command pool implementation.  This function MUST