From ed429af5864631b196c7299f17e725540544b213 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 21 Jun 2022 16:44:33 +0200 Subject: [PATCH] radv: Don't check if we need to copy immutable samplers for non push templates. This should allow the compiler to optimize this out because it knows that cmd_buffer is NULL. Signed-off-by: Georg Lehmann Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_descriptor_set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index 46ebb53d71c..428ad412e88 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -1566,7 +1566,7 @@ radv_update_descriptor_set_with_template_impl(struct radv_device *device, device, cmd_buffer, templ->entry[i].sampler_offset, pDst, buffer_list, templ->entry[i].descriptor_type, (struct VkDescriptorImageInfo *)pSrc, templ->entry[i].has_sampler); - if (templ->entry[i].immutable_samplers) { + if (cmd_buffer && templ->entry[i].immutable_samplers) { memcpy((char *)pDst + templ->entry[i].sampler_offset, templ->entry[i].immutable_samplers + 4 * j, 16); } @@ -1574,7 +1574,7 @@ radv_update_descriptor_set_with_template_impl(struct radv_device *device, case VK_DESCRIPTOR_TYPE_SAMPLER: if (templ->entry[i].has_sampler) write_sampler_descriptor(device, pDst, (struct VkDescriptorImageInfo *)pSrc); - else if (templ->entry[i].immutable_samplers) + else if (cmd_buffer && templ->entry[i].immutable_samplers) memcpy(pDst, templ->entry[i].immutable_samplers + 4 * j, 16); break; case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: