zink: add a ctx param to zink_descriptor_util_image_layout_eval

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15716>
This commit is contained in:
Mike Blumenkrantz 2022-04-05 14:56:24 -04:00 committed by Marge Bot
parent 7781a75229
commit ef99ceaec2
4 changed files with 7 additions and 7 deletions

View file

@ -1291,8 +1291,8 @@ unbind_shader_image_counts(struct zink_context *ctx, struct zink_resource *res,
ALWAYS_INLINE static void
check_for_layout_update(struct zink_context *ctx, struct zink_resource *res, bool is_compute)
{
VkImageLayout layout = res->bind_count[is_compute] ? zink_descriptor_util_image_layout_eval(res, is_compute) : VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout other_layout = res->bind_count[!is_compute] ? zink_descriptor_util_image_layout_eval(res, !is_compute) : VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout layout = res->bind_count[is_compute] ? zink_descriptor_util_image_layout_eval(ctx, res, is_compute) : VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout other_layout = res->bind_count[!is_compute] ? zink_descriptor_util_image_layout_eval(ctx, res, !is_compute) : VK_IMAGE_LAYOUT_UNDEFINED;
if (res->bind_count[is_compute] && layout && res->layout != layout)
_mesa_set_add(ctx->need_barriers[is_compute], res);
if (res->bind_count[!is_compute] && other_layout && (layout != other_layout || res->layout != other_layout))
@ -1695,7 +1695,7 @@ zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bo
VkDescriptorImageInfo *ii = &ctx->di.bindless[0].img_infos[handle];
ii->sampler = bd->sampler->sampler;
ii->imageView = ds->surface->image_view;
ii->imageLayout = zink_descriptor_util_image_layout_eval(res, false);
ii->imageLayout = zink_descriptor_util_image_layout_eval(ctx, res, false);
flush_pending_clears(ctx, res);
check_for_layout_update(ctx, res, false);
check_for_layout_update(ctx, res, true);
@ -2940,7 +2940,7 @@ resource_check_defer_image_barrier(struct zink_context *ctx, struct zink_resourc
if (res->bind_count[!is_compute] && is_shader) {
/* if the layout is the same between gfx and compute, do nothing */
if (layout == zink_descriptor_util_image_layout_eval(res, !is_compute))
if (layout == zink_descriptor_util_image_layout_eval(ctx, res, !is_compute))
return;
}
/* queue a layout change if a layout change will be needed */

View file

@ -559,7 +559,7 @@ zink_descriptor_util_push_layouts_get(struct zink_context *ctx, struct zink_desc
}
VkImageLayout
zink_descriptor_util_image_layout_eval(const struct zink_resource *res, bool is_compute)
zink_descriptor_util_image_layout_eval(const struct zink_context *ctx, const struct zink_resource *res, bool is_compute)
{
if (res->bindless[0] || res->bindless[1]) {
/* bindless needs most permissive layout */

View file

@ -217,7 +217,7 @@ zink_descriptor_util_init_fbfetch(struct zink_context *ctx);
bool
zink_descriptor_util_push_layouts_get(struct zink_context *ctx, struct zink_descriptor_layout **dsls, struct zink_descriptor_layout_key **layout_keys);
VkImageLayout
zink_descriptor_util_image_layout_eval(const struct zink_resource *res, bool is_compute);
zink_descriptor_util_image_layout_eval(const struct zink_context *ctx, const struct zink_resource *res, bool is_compute);
void
zink_descriptors_init_bindless(struct zink_context *ctx);
void

View file

@ -420,7 +420,7 @@ update_barriers(struct zink_context *ctx, bool is_compute)
if (res->base.b.target == PIPE_BUFFER)
zink_resource_buffer_barrier(ctx, res, access, pipeline);
else {
VkImageLayout layout = zink_descriptor_util_image_layout_eval(res, is_compute);
VkImageLayout layout = zink_descriptor_util_image_layout_eval(ctx, res, is_compute);
if (layout != res->layout)
zink_resource_image_barrier(ctx, res, layout, access, pipeline);
}