radv: Split off cmd_buffer variant of descriptor set template updates
Assumes cmd_buffer != NULL for this path to eliminate the checks in the generic code. Benchmarks: I made a microbenchmark based on Bas' vulkan microbench suite. https://gitlab.freedesktop.org/bnieuwenhuizen/vulkan_microbench/-/merge_requests/1 In this benchmark, this improves vkDescriptorTemplateUpdate performance consistently by 36%. ------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------- DescriptorTemplateUpdate 81.2 ns 81.2 ns 8573169 -> ------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------- DescriptorTemplateUpdate 52.9 ns 52.9 ns 13306065 Signed-off-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13342>
This commit is contained in:
@@ -4732,8 +4732,8 @@ radv_CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer,
|
||||
templ->bind_point))
|
||||
return;
|
||||
|
||||
radv_update_descriptor_set_with_template(cmd_buffer->device, cmd_buffer, push_set,
|
||||
descriptorUpdateTemplate, pData);
|
||||
radv_cmd_update_descriptor_set_with_template(cmd_buffer->device, cmd_buffer, push_set,
|
||||
descriptorUpdateTemplate, pData);
|
||||
|
||||
radv_set_descriptor_set(cmd_buffer, templ->bind_point, push_set, set);
|
||||
descriptors_state->push_dirty = true;
|
||||
|
||||
@@ -1420,12 +1420,12 @@ radv_DestroyDescriptorUpdateTemplate(VkDevice _device,
|
||||
vk_free2(&device->vk.alloc, pAllocator, templ);
|
||||
}
|
||||
|
||||
void
|
||||
radv_update_descriptor_set_with_template(struct radv_device *device,
|
||||
struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_descriptor_set *set,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
const void *pData)
|
||||
static ALWAYS_INLINE void
|
||||
radv_update_descriptor_set_with_template_impl(struct radv_device *device,
|
||||
struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_descriptor_set *set,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
const void *pData)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_descriptor_update_template, templ, descriptorUpdateTemplate);
|
||||
uint32_t i;
|
||||
@@ -1502,6 +1502,18 @@ radv_update_descriptor_set_with_template(struct radv_device *device,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
radv_cmd_update_descriptor_set_with_template(struct radv_device *device,
|
||||
struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_descriptor_set *set,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
const void *pData)
|
||||
{
|
||||
/* Assume cmd_buffer != NULL to optimize out cmd_buffer checks in generic code above. */
|
||||
assume(cmd_buffer != NULL);
|
||||
radv_update_descriptor_set_with_template_impl(device, cmd_buffer, set, descriptorUpdateTemplate, pData);
|
||||
}
|
||||
|
||||
void
|
||||
radv_UpdateDescriptorSetWithTemplate(VkDevice _device, VkDescriptorSet descriptorSet,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
@@ -1510,7 +1522,7 @@ radv_UpdateDescriptorSetWithTemplate(VkDevice _device, VkDescriptorSet descripto
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_descriptor_set, set, descriptorSet);
|
||||
|
||||
radv_update_descriptor_set_with_template(device, NULL, set, descriptorUpdateTemplate, pData);
|
||||
radv_update_descriptor_set_with_template_impl(device, NULL, set, descriptorUpdateTemplate, pData);
|
||||
}
|
||||
|
||||
VkResult
|
||||
|
||||
@@ -2583,11 +2583,11 @@ void radv_cmd_update_descriptor_sets(struct radv_device *device, struct radv_cmd
|
||||
uint32_t descriptorCopyCount,
|
||||
const VkCopyDescriptorSet *pDescriptorCopies);
|
||||
|
||||
void radv_update_descriptor_set_with_template(struct radv_device *device,
|
||||
struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_descriptor_set *set,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
const void *pData);
|
||||
void radv_cmd_update_descriptor_set_with_template(struct radv_device *device,
|
||||
struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_descriptor_set *set,
|
||||
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
|
||||
const void *pData);
|
||||
|
||||
void radv_meta_push_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
|
||||
VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout _layout,
|
||||
|
||||
Reference in New Issue
Block a user