Mesa (main): radv: Don't check if we need to copy immutable samplers for non push templates.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 24 06:56:28 UTC 2022


Module: Mesa
Branch: main
Commit: ed429af5864631b196c7299f17e725540544b213
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed429af5864631b196c7299f17e725540544b213

Author: Georg Lehmann <dadschoorse at gmail.com>
Date:   Tue Jun 21 16:44:33 2022 +0200

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 <dadschoorse at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17166>

---

 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:



More information about the mesa-commit mailing list