Mesa (main): lavapipe: clamp clear attachments rects

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 8 22:18:18 UTC 2022


Module: Mesa
Branch: main
Commit: 2d1b506acfe55165511a2bb83acb013353e531ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d1b506acfe55165511a2bb83acb013353e531ab

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jan 21 14:31:30 2022 -0500

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 at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14655>

---

 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) {



More information about the mesa-commit mailing list