From 340cfa1001eabb81812ad4c311c75e7279d3feb3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 12 Oct 2022 11:51:14 -0400 Subject: [PATCH] zink: fix pool overflow handling on batch reset this mechanism worked off the previous iteration of descriptor updating, in which pools were stored in a set to the batch state and could be iterated normally now, however, they're stored as a sparse array, and so the dynarray util for getting the number of elements cannot be used instead, use the calculated size for the array like every other accessor for the pools to ensure correct indexing Part-of: --- src/gallium/drivers/zink/zink_descriptors.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index 5ac4df5..1d3aaa5 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -994,8 +994,7 @@ zink_batch_descriptor_reset(struct zink_screen *screen, struct zink_batch_state { for (unsigned i = 0; i < ZINK_DESCRIPTOR_TYPES; i++) { struct zink_descriptor_pool_multi **mpools = bs->dd.pools[i].data; - unsigned count = util_dynarray_num_elements(&bs->dd.pools[i], struct zink_descriptor_pool_multi *); - for (unsigned j = 0; j < count; j++) { + for (unsigned j = 0; j < bs->dd.pool_size[i]; j++) { struct zink_descriptor_pool_multi *mpool = mpools[j]; if (!mpool) continue; -- 2.7.4