lavapipe: clamp clear attachments rects

there is at least one unnamed game which has problems with this, so try
to avoid crashing

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14655>
This commit is contained in:
Mike Blumenkrantz 2022-01-21 14:31:30 -05:00 committed by Marge Bot
parent 4c76a19ca3
commit 2d1b506acf
1 changed files with 2 additions and 0 deletions

View File

@ -3203,6 +3203,8 @@ static void handle_clear_attachments(struct vk_cmd_queue_entry *cmd,
VkClearRect *rect = &cmd->u.clear_attachments.rects[r];
/* avoid crashing on spec violations */
rect->rect.offset.x = MAX2(rect->rect.offset.x, 0);
rect->rect.offset.y = MAX2(rect->rect.offset.y, 0);
rect->rect.extent.width = MIN2(rect->rect.extent.width, state->framebuffer.width - rect->rect.offset.x);
rect->rect.extent.height = MIN2(rect->rect.extent.height, state->framebuffer.height - rect->rect.offset.y);
if (subpass->view_mask) {