lavapipe: do not read sampler descriptor info during update if layout has immutables
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 4 May 2021 15:57:41 +0000 (11:57 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 6 May 2021 14:59:31 +0000 (14:59 +0000)
this is illegal

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

src/gallium/frontends/lavapipe/lvp_descriptor_set.c

index d884403..4714947 100644 (file)
@@ -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;