From 8daf8ff730b777bb512a237a36783d781cbf9de9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 26 Apr 2022 11:36:23 -0400 Subject: [PATCH] zink: use descriptor surfaces for notemplates ref updating basically the same codepath as samplerviews now, and fixes some issues with invalid mem access cc: mesa-stable Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_descriptors.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index d98478903e4..8442fa4d146 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -1157,8 +1157,8 @@ desc_set_sampler_add(struct zink_context *ctx, struct zink_descriptor_set *zds, } static void -desc_set_image_add(struct zink_context *ctx, struct zink_descriptor_set *zds, struct zink_image_view *image_view, - unsigned int i, bool is_buffer, bool cache_hit) +desc_set_image_add(struct zink_context *ctx, struct zink_descriptor_set *zds, struct zink_descriptor_surface *dsurf, + unsigned int i, bool cache_hit) { /* if we got a cache hit, we have to verify that the cached set is still valid; * we store the vk resource to the set here to avoid a more complex and costly mechanism of maintaining a @@ -1167,11 +1167,11 @@ desc_set_image_add(struct zink_context *ctx, struct zink_descriptor_set *zds, st */ #ifndef NDEBUG uint32_t cur_hash = get_descriptor_surface_hash(ctx, &zds->surfaces[i]); - uint32_t new_hash = zink_get_image_view_hash(ctx, image_view, is_buffer); + uint32_t new_hash = get_descriptor_surface_hash(ctx, dsurf); #endif assert(!cache_hit || cur_hash == new_hash); if (!cache_hit) - zink_image_view_desc_set_add(image_view, zds, i, is_buffer); + zink_descriptor_surface_desc_set_add(dsurf, zds, i); } static void @@ -1363,8 +1363,7 @@ update_descriptors_internal(struct zink_context *ctx, enum zink_descriptor_type desc_set_sampler_add(ctx, zds, &ctx->di.sampler_surfaces[stage][index + k], sampler, num_resources++, cache_hit); } else { - struct zink_image_view *image_view = &ctx->image_views[stage][index + k]; - desc_set_image_add(ctx, zds, image_view, num_resources++, is_buffer, cache_hit); + desc_set_image_add(ctx, zds, &ctx->di.image_surfaces[stage][index + k], num_resources++, cache_hit); } } if (is_buffer)