lvp: avoid reading immutable sampler from desc write info
authorYiwei Zhang <zzyiwei@chromium.org>
Thu, 20 Jul 2023 18:47:52 +0000 (11:47 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Jul 2023 17:11:26 +0000 (17:11 +0000)
Lavapipe has switched to layer push descriptor support atop descriptor
updates internally since 12a7fc51c77925a5562fd104a8fbd664a46ffc8b, so
it must skip retrieving immutable samplers from the write info even if
the update call itself is blessed by the spec to not hit that case.

Fixes: 12a7fc51c77 ("lavapipe: Rework descriptor handling")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24263>

src/gallium/frontends/lavapipe/lvp_descriptor_set.c

index 5509730..8ae2bb1 100644 (file)
@@ -449,12 +449,13 @@ VKAPI_ATTR void VKAPI_CALL lvp_UpdateDescriptorSets(
 
       switch (write->descriptorType) {
       case VK_DESCRIPTOR_TYPE_SAMPLER:
-         for (uint32_t j = 0; j < write->descriptorCount; j++) {
-            LVP_FROM_HANDLE(lvp_sampler, sampler,
-                            write->pImageInfo[j].sampler);
+         if (!bind_layout->immutable_samplers) {
+            for (uint32_t j = 0; j < write->descriptorCount; j++) {
+               LVP_FROM_HANDLE(lvp_sampler, sampler, write->pImageInfo[j].sampler);
 
-            desc[j].sampler = sampler->desc.sampler;
-            desc[j].sampler_index = sampler->desc.sampler_index;
+               desc[j].sampler = sampler->desc.sampler;
+               desc[j].sampler_index = sampler->desc.sampler_index;
+            }
          }
          break;