zink: use GENERAL layout for depth attachments on some drivers

this matches a vkd3d optimization

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30261>
This commit is contained in:
Mike Blumenkrantz
2024-07-09 12:03:31 -04:00
committed by Marge Bot
parent 991244dad4
commit ce1236fe87
3 changed files with 15 additions and 0 deletions

View File

@@ -3182,6 +3182,10 @@ zink_prep_fb_attachment(struct zink_context *ctx, struct zink_surface *surf, uns
else if (!screen->info.have_EXT_attachment_feedback_loop_layout &&
layout == VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT)
layout = VK_IMAGE_LAYOUT_GENERAL;
/* some drivers don't care about zs layouts for attachments, so this saves some layout transition cycles */
else if (layout != VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT &&
i >= ctx->fb_state.nr_cbufs && screen->driver_workarounds.general_depth_layout)
layout = VK_IMAGE_LAYOUT_GENERAL;
if (res->valid || res->layout != layout)
screen->image_barrier(ctx, res, layout, access, pipeline);
if (!(res->aspect & VK_IMAGE_ASPECT_COLOR_BIT))

View File

@@ -3057,6 +3057,16 @@ init_driver_workarounds(struct zink_screen *screen)
break;
}
switch (zink_driverid(screen)) {
case VK_DRIVER_ID_MESA_RADV:
case VK_DRIVER_ID_MESA_NVK:
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
screen->driver_workarounds.general_depth_layout = true;
break;
default:
break;
}
if (!screen->resizable_bar)
screen->info.have_EXT_host_image_copy = false;
}

View File

@@ -1549,6 +1549,7 @@ struct zink_screen {
bool can_do_invalid_linear_modifier;
bool inconsistent_interpolation;
bool can_2d_view_sparse;
bool general_depth_layout;
unsigned z16_unscaled_bias;
unsigned z24_unscaled_bias;
} driver_workarounds;