zink: hook up surface invalidation to LOAD_OP_DONT_CARE

this should improve perf for tilers

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16877>
This commit is contained in:
Mike Blumenkrantz
2022-06-03 13:57:30 -04:00
committed by Marge Bot
parent c7ad86b40f
commit de1e67b39d
2 changed files with 7 additions and 4 deletions

View File

@@ -2034,7 +2034,7 @@ begin_rendering(struct zink_context *ctx)
/* dead swapchain */
return 0;
ctx->dynamic_fb.attachments[i].imageView = iv;
if (!surf || (surf->is_swapchain && ctx->new_swapchain))
if (!surf || !zink_resource(surf->base.texture)->valid || (surf->is_swapchain && ctx->new_swapchain))
ctx->dynamic_fb.attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
else
ctx->dynamic_fb.attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
@@ -2056,12 +2056,15 @@ begin_rendering(struct zink_context *ctx)
/* depth may or may not be used but init it anyway */
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].imageView = iv;
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].imageLayout = zink_resource(surf->base.texture)->layout;
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
if (zink_resource(surf->base.texture)->valid)
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
else
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
/* stencil may or may not be used but init it anyway */
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].imageView = iv;
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].imageLayout = zink_resource(surf->base.texture)->layout;
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].loadOp = ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].loadOp;
if (has_depth) {
ctx->dynamic_fb.info.pDepthAttachment = &ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS];

View File

@@ -353,7 +353,7 @@ zink_init_color_attachment(struct zink_context *ctx, unsigned i, struct zink_rt_
rt->format = surf->info.format[0];
rt->samples = MAX3(transient ? transient->base.nr_samples : 0, psurf->texture->nr_samples, 1);
rt->clear_color = zink_fb_clear_enabled(ctx, i) && !zink_fb_clear_first_needs_explicit(&ctx->fb_clears[i]);
rt->invalid = ctx->new_swapchain && (psurf->texture->bind & PIPE_BIND_DISPLAY_TARGET);
rt->invalid = !zink_resource(psurf->texture)->valid || (ctx->new_swapchain && (psurf->texture->bind & PIPE_BIND_DISPLAY_TARGET));
rt->fbfetch = (ctx->fbfetch_outputs & BITFIELD_BIT(i)) > 0;
} else {
memset(rt, 0, sizeof(struct zink_rt_attrib));