From c1c39116a7716e8aa45d6e2bcd7452aba17e10ed Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 1 Mar 2024 13:00:20 -0500 Subject: [PATCH] vulkan/runtime: Add driver callbacks for BVH building All of these are functions that could reasonably be incorporated into a Vulkan extension, but are currently missing. While we could in theory do BVH building without them, using them simplifies the code significantly and both radv and turnip can reasonably implement them. Reviewed-by: Konstantin Seurer Reviewed-by: Sagar Ghuge Part-of: --- src/vulkan/runtime/vk_device.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/vulkan/runtime/vk_device.h b/src/vulkan/runtime/vk_device.h index 2a6d1d14338..4d7220f832f 100644 --- a/src/vulkan/runtime/vk_device.h +++ b/src/vulkan/runtime/vk_device.h @@ -134,6 +134,37 @@ struct vk_device { /** Shader vtable for VK_EXT_shader_object and common pipelines */ const struct vk_device_shader_ops *shader_ops; + /** + * Write data to a buffer from the command processor. This is simpler than + * setting up a staging buffer and faster for small writes, but is not + * meant for larger amounts of data. \p data is owned by the caller and the + * driver is expected to write it out directly to the command stream as + * part of an immediate write packet. + */ + void (*write_buffer_cp)(VkCommandBuffer cmdbuf, VkDeviceAddress addr, + void *data, uint32_t size); + + /* Flush data written via write_buffer_cp. Users must use a normal pipeline + * barrier in order to read this data, with the appropriate destination + * access, but this replaces the source access mask. + */ + void (*flush_buffer_write_cp)(VkCommandBuffer cmdbuf); + + /* An unaligned dispatch function. This launches a number of threads that + * may not be a multiple of the workgroup size, which may result in partial + * workgroups. + */ + void (*cmd_dispatch_unaligned)(VkCommandBuffer cmdbuf, + uint32_t invocations_x, + uint32_t invocations_y, + uint32_t invocations_z); + + /* vkCmdFillBuffer but with a device address. */ + void (*cmd_fill_buffer_addr)(VkCommandBuffer cmdbuf, + VkDeviceAddress devAddr, + VkDeviceSize size, + uint32_t data); + /** Driver provided callback for capturing traces * * Triggers for this callback are: