mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
zink: verify that src/dst support blitting
Some Vulkan-drivers don't support blitting between all formats and layouts. So let's verify this while blitting, and fall back to the normal rendering code-path instead. This fixes a crash on start-up in OpenArena on V3DV. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10234>
This commit is contained in:
parent
8ddbac0377
commit
0ba3cf1f95
1 changed files with 12 additions and 0 deletions
|
|
@ -91,6 +91,14 @@ blit_resolve(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
return true;
|
||||
}
|
||||
|
||||
static VkFormatFeatureFlags
|
||||
get_resource_features(struct zink_screen *screen, struct zink_resource *res)
|
||||
{
|
||||
VkFormatProperties props = screen->format_props[res->base.b.format];
|
||||
return res->optimal_tiling ? props.optimalTilingFeatures :
|
||||
props.linearTilingFeatures;
|
||||
}
|
||||
|
||||
static bool
|
||||
blit_native(struct zink_context *ctx, const struct pipe_blit_info *info)
|
||||
{
|
||||
|
|
@ -120,6 +128,10 @@ blit_native(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
dst->format != zink_get_format(screen, info->dst.format))
|
||||
return false;
|
||||
|
||||
if (!(get_resource_features(screen, src) & VK_FORMAT_FEATURE_BLIT_SRC_BIT) ||
|
||||
!(get_resource_features(screen, dst) & VK_FORMAT_FEATURE_BLIT_DST_BIT))
|
||||
return false;
|
||||
|
||||
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), false);
|
||||
zink_fb_clears_apply_region(ctx, info->src.resource, zink_rect_from_box(&info->src.box));
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue