zink: put back the sampler barrier on fb unbind with GENERAL layouts

this is actually critical to avoid splitting renderpasses regardless of
the layout being used

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35476>
This commit is contained in:
Mike Blumenkrantz
2025-06-11 15:02:21 -04:00
committed by Marge Bot
parent 41d241bf6e
commit 4483c6195d
+8 -7
View File
@@ -3804,14 +3804,15 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, unsigned
res->fb_binds &= ~BITFIELD_BIT(idx);
batch_ref_fb_surface(ctx, surf);
/* this is called just before the resource loses a reference, so a refcount==1 means the resource will be destroyed */
if (!general_layout && !res->fb_bind_count && res->base.b.reference.count > 1) {
if (!res->fb_bind_count && res->base.b.reference.count > 1) {
if (ctx->track_renderpasses && !ctx->blitting) {
if (!(res->base.b.bind & PIPE_BIND_DISPLAY_TARGET) && util_format_is_depth_or_stencil(surf->format))
/* assume that all depth buffers which are not swapchain images will be used for sampling to avoid splitting renderpasses */
zink_screen(ctx->base.screen)->image_barrier(ctx, res, VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
if (!zink_is_swapchain(res) && !util_format_is_depth_or_stencil(surf->format))
/* assume that all color buffers which are not swapchain images will be used for sampling to avoid splitting renderpasses */
zink_screen(ctx->base.screen)->image_barrier(ctx, res, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
VkImageLayout layout = general_layout ? VK_IMAGE_LAYOUT_GENERAL :
/* assume that all depth buffers which are not swapchain images will be used for sampling to avoid splitting renderpasses */
!(res->base.b.bind & PIPE_BIND_DISPLAY_TARGET) && util_format_is_depth_or_stencil(surf->format) ?
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL :
/* assume that all color buffers which are not swapchain images will be used for sampling to avoid splitting renderpasses */
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
zink_screen(ctx->base.screen)->image_barrier(ctx, res, layout, VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
}
if (res->sampler_bind_count[0]) {
update_res_sampler_layouts(ctx, res);