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

Author: Lionel Landwerlin <[email protected]>
Date:   Thu Mar  2 07:47:24 2023 +0200

anv/hasvk: speed up null image/view descriptor writes

Signed-off-by: Lionel Landwerlin <[email protected]>
Reported-by: Chuansheng Liu <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21642>

---

 src/intel/vulkan/anv_descriptor_set.c       | 4 ++++
 src/intel/vulkan_hasvk/anv_descriptor_set.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/intel/vulkan/anv_descriptor_set.c 
b/src/intel/vulkan/anv_descriptor_set.c
index 5cab178a652..84c2dc6796c 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -1405,6 +1405,10 @@ anv_descriptor_set_write_image_view(struct anv_device 
*device,
    void *desc_map = set->desc_mem.map + bind_layout->descriptor_offset +
                     element * bind_layout->descriptor_stride;
    memset(desc_map, 0, bind_layout->descriptor_stride);
+
+   if (image_view == NULL && sampler == NULL)
+      return;
+
    enum anv_descriptor_data data =
       bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
       anv_descriptor_data_for_type(device->physical, type) :
diff --git a/src/intel/vulkan_hasvk/anv_descriptor_set.c 
b/src/intel/vulkan_hasvk/anv_descriptor_set.c
index 69efed4e544..951aba8ce88 100644
--- a/src/intel/vulkan_hasvk/anv_descriptor_set.c
+++ b/src/intel/vulkan_hasvk/anv_descriptor_set.c
@@ -1400,6 +1400,10 @@ anv_descriptor_set_write_image_view(struct anv_device 
*device,
    void *desc_map = set->desc_mem.map + bind_layout->descriptor_offset +
                     element * bind_layout->descriptor_stride;
    memset(desc_map, 0, bind_layout->descriptor_stride);
+
+   if (image_view == NULL && sampler == NULL)
+      return;
+
    enum anv_descriptor_data data =
       bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
       anv_descriptor_data_for_type(device->physical, type) :

Reply via email to