lavapipe: clamp clear attachments rects
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 21 Jan 2022 19:31:30 +0000 (14:31 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 8 Mar 2022 22:03:28 +0000 (22:03 +0000)
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>

src/gallium/frontends/lavapipe/lvp_execute.c

index 815f1eb..c88e93c 100644 (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) {