Mesa (staging/21.0): lavapipe: fix templated descriptor updates

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 25 18:01:52 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: e37442f1b804b6b973817713583618ca2816bcf9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e37442f1b804b6b973817713583618ca2816bcf9

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Mar 18 14:09:50 2021 +1000

lavapipe: fix templated descriptor updates

The template path was buggy but CTS only tested it with Vulkan 1.1 enabled.

It was just missing the dstArrayElement offset.

Fixes: 41f7fa273d21 ("lavapipe: add support for VK_KHR_descriptor_update_template")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9675>
(cherry picked from commit 833847603bd3ed527425c4e8b5565cdb7a1f8622)

---

 .pick_status.json                                   |  2 +-
 src/gallium/frontends/lavapipe/lvp_descriptor_set.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index d0549132166..331a1d27044 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2560,7 +2560,7 @@
         "description": "lavapipe: fix templated descriptor updates",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "41f7fa273d21566d82a6376fb3ad4e44c5e57d33"
     },
diff --git a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
index b4bc5003c2d..8cbd77c3036 100644
--- a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
+++ b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
@@ -567,11 +567,12 @@ void lvp_UpdateDescriptorSetWithTemplate(VkDevice _device,
       struct lvp_descriptor *desc =
          &set->descriptors[bind_layout->descriptor_index];
       for (j = 0; j < entry->descriptorCount; ++j) {
+         unsigned idx = j + entry->dstArrayElement;
          switch (entry->descriptorType) {
          case VK_DESCRIPTOR_TYPE_SAMPLER: {
             LVP_FROM_HANDLE(lvp_sampler, sampler,
                             *(VkSampler *)pSrc);
-            desc[j] = (struct lvp_descriptor) {
+            desc[idx] = (struct lvp_descriptor) {
                .type = VK_DESCRIPTOR_TYPE_SAMPLER,
                .info.sampler = sampler,
             };
@@ -579,7 +580,7 @@ void lvp_UpdateDescriptorSetWithTemplate(VkDevice _device,
          }
          case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
             VkDescriptorImageInfo *info = (VkDescriptorImageInfo *)pSrc;
-            desc[j] = (struct lvp_descriptor) {
+            desc[idx] = (struct lvp_descriptor) {
                .type = entry->descriptorType,
                .info.iview = lvp_image_view_from_handle(info->imageView),
                .info.sampler = lvp_sampler_from_handle(info->sampler),
@@ -591,7 +592,7 @@ void lvp_UpdateDescriptorSetWithTemplate(VkDevice _device,
          case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
             LVP_FROM_HANDLE(lvp_image_view, iview,
                             ((VkDescriptorImageInfo *)pSrc)->imageView);
-            desc[j] = (struct lvp_descriptor) {
+            desc[idx] = (struct lvp_descriptor) {
                .type = entry->descriptorType,
                .info.iview = iview,
             };
@@ -601,7 +602,7 @@ void lvp_UpdateDescriptorSetWithTemplate(VkDevice _device,
          case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
             LVP_FROM_HANDLE(lvp_buffer_view, bview,
                             *(VkBufferView *)pSrc);
-            desc[j] = (struct lvp_descriptor) {
+            desc[idx] = (struct lvp_descriptor) {
                .type = entry->descriptorType,
                .info.buffer_view = bview,
             };
@@ -613,7 +614,7 @@ void lvp_UpdateDescriptorSetWithTemplate(VkDevice _device,
          case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
          case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
             VkDescriptorBufferInfo *info = (VkDescriptorBufferInfo *)pSrc;
-            desc[j] = (struct lvp_descriptor) {
+            desc[idx] = (struct lvp_descriptor) {
                .type = entry->descriptorType,
                .info.offset = info->offset,
                .info.buffer = lvp_buffer_from_handle(info->buffer),



More information about the mesa-commit mailing list