Mesa (main): lavapipe: do not read sampler descriptor info during update if layout has immutables

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 6 15:09:34 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May  4 11:57:41 2021 -0400

lavapipe: do not read sampler descriptor info during update if layout has immutables

this is illegal

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10625>

---

 src/gallium/frontends/lavapipe/lvp_descriptor_set.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
index d8844031b68..4714947a883 100644
--- a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
+++ b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
@@ -388,17 +388,21 @@ VKAPI_ATTR void VKAPI_CALL lvp_UpdateDescriptorSets(
          for (uint32_t j = 0; j < write->descriptorCount; j++) {
             LVP_FROM_HANDLE(lvp_image_view, iview,
                             write->pImageInfo[j].imageView);
-            LVP_FROM_HANDLE(lvp_sampler, sampler,
-                            write->pImageInfo[j].sampler);
-
             desc[j].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
             desc[j].info.iview = iview;
-
-            /* If this descriptor has an immutable sampler, we don't want
-             * to stomp on it.
+            /*
+             * All consecutive bindings updated via a single VkWriteDescriptorSet structure, except those
+             * with a descriptorCount of zero, must all either use immutable samplers or must all not
+             * use immutable samplers
              */
-            if (sampler)
+            if (bind_layout->immutable_samplers) {
+               desc[j].info.sampler = bind_layout->immutable_samplers[j];
+            } else {
+               LVP_FROM_HANDLE(lvp_sampler, sampler,
+                               write->pImageInfo[j].sampler);
+
                desc[j].info.sampler = sampler;
+            }
          }
          break;
 



More information about the mesa-commit mailing list