zink: fix descriptor cache pointer array allocation
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 2 Mar 2022 20:49:29 +0000 (15:49 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 7 Mar 2022 04:07:58 +0000 (04:07 +0000)
this got mixed up during some refactor and started indexing based on the
number of bindings instead of the number of descriptors, which means
that array descriptor bindings would have overlapping array memory

cc: mesa-stable

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15226>

src/gallium/drivers/zink/zink_descriptors.c

index 118fd9e..27111cc 100644 (file)
@@ -678,13 +678,13 @@ allocate_desc_set(struct zink_context *ctx, struct zink_program *pg, enum zink_d
 #endif
       switch (type) {
       case ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW:
-         zds->sampler_states = (struct zink_sampler_state**)&samplers[i * pool->key->layout->num_bindings];
+         zds->sampler_states = (struct zink_sampler_state**)&samplers[i * num_resources];
          FALLTHROUGH;
       case ZINK_DESCRIPTOR_TYPE_IMAGE:
-         zds->surfaces = &surfaces[i * pool->key->layout->num_bindings];
+         zds->surfaces = &surfaces[i * num_resources];
          break;
       default:
-         zds->res_objs = (struct zink_resource_object**)&res_objs[i * pool->key->layout->num_bindings];
+         zds->res_objs = (struct zink_resource_object**)&res_objs[i * num_resources];
          break;
       }
       zds->desc_set = desc_set[i];