From 2d1b506acfe55165511a2bb83acb013353e531ab Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 21 Jan 2022 14:31:30 -0500 Subject: [PATCH] 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 Part-of: --- src/gallium/frontends/lavapipe/lvp_execute.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 815f1eb0270..c88e93caea0 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -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) {