zink: move flagging rp_changed in zink_update_fbfetch() to caller

this avoids recursive flagging when starting a renderpass

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27684>
This commit is contained in:
Mike Blumenkrantz 2024-02-16 10:30:15 -05:00 committed by Marge Bot
parent 35185ad9df
commit fe13841a99
2 changed files with 9 additions and 8 deletions

View file

@ -2614,22 +2614,21 @@ zink_set_patch_vertices(struct pipe_context *pctx, uint8_t patch_vertices)
}
}
void
bool
zink_update_fbfetch(struct zink_context *ctx)
{
const bool had_fbfetch = ctx->di.fbfetch.imageLayout == VK_IMAGE_LAYOUT_GENERAL;
if (!ctx->gfx_stages[MESA_SHADER_FRAGMENT] ||
!ctx->gfx_stages[MESA_SHADER_FRAGMENT]->info.fs.uses_fbfetch_output) {
if (!had_fbfetch)
return;
ctx->rp_changed = true;
return false;
zink_batch_no_rp(ctx);
ctx->di.fbfetch.imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
ctx->di.fbfetch.imageView = zink_screen(ctx->base.screen)->info.rb2_feats.nullDescriptor ?
VK_NULL_HANDLE :
zink_get_dummy_surface(ctx, 0)->image_view;
ctx->invalidate_descriptor_state(ctx, MESA_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
return;
return true;
}
bool changed = !had_fbfetch;
@ -2637,7 +2636,7 @@ zink_update_fbfetch(struct zink_context *ctx)
VkImageView fbfetch = zink_csurface(ctx->fb_state.cbufs[0])->image_view;
if (!fbfetch)
/* swapchain image: retry later */
return;
return false;
changed |= fbfetch != ctx->di.fbfetch.imageView;
ctx->di.fbfetch.imageView = zink_csurface(ctx->fb_state.cbufs[0])->image_view;
@ -2645,14 +2644,16 @@ zink_update_fbfetch(struct zink_context *ctx)
if (zink_get_fs_base_key(ctx)->fbfetch_ms != fbfetch_ms)
zink_set_fs_base_key(ctx)->fbfetch_ms = fbfetch_ms;
}
bool ret = false;
ctx->di.fbfetch.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
if (changed) {
ctx->invalidate_descriptor_state(ctx, MESA_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
if (!had_fbfetch) {
ctx->rp_changed = true;
ret = true;
zink_batch_no_rp(ctx);
}
}
return ret;
}
void
@ -3631,7 +3632,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
}
util_copy_framebuffer_state(&ctx->fb_state, state);
zink_update_fbfetch(ctx);
ctx->rp_changed |= zink_update_fbfetch(ctx);
ctx->transient_attachments = 0;
ctx->fb_layer_mismatch = 0;

View file

@ -109,7 +109,7 @@ unsigned
zink_update_rendering_info(struct zink_context *ctx);
void
zink_flush_queue(struct zink_context *ctx);
void
bool
zink_update_fbfetch(struct zink_context *ctx);
bool
zink_resource_access_is_write(VkAccessFlags flags);