Mesa (staging/21.0): mesa/st: clamp scissored clear regions to fb size

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 5 19:46:07 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: 745f16de0084a5f689507c62e5d48f455a10c395
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=745f16de0084a5f689507c62e5d48f455a10c395

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Mar  1 14:52:25 2021 -0500

mesa/st: clamp scissored clear regions to fb size

these should never be larger than the fb and drivers shouldn't have to
care about it

Fixes: 1c8bcad81a7 ("gallium: add pipe cap for scissored clears and pass scissor state to clear() hook")

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9344>
(cherry picked from commit c5e72eb09daba7a087006f6ade691798f759a23c)

---

 .pick_status.json                    | 2 +-
 src/mesa/state_tracker/st_cb_clear.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index a9926b6f911..0e49d44bb39 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1633,7 +1633,7 @@
         "description": "mesa/st: clamp scissored clear regions to fb size",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "1c8bcad81a7ce106b37f1ee4a75b817651d6545e"
     },
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 408d29aff74..1fda7dbc6cf 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -534,6 +534,11 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
          scissor_state.miny = MAX2(miny, 0);
          scissor_state.maxy = MAX2(maxy, 0);
       }
+      if (have_scissor_buffers) {
+         const struct gl_framebuffer *fb = ctx->DrawBuffer;
+         scissor_state.maxx = MIN2(scissor_state.maxx, fb->Width);
+         scissor_state.maxy = MIN2(scissor_state.maxy, fb->Height);
+      }
       /* We can't translate the clear color to the colorbuffer format,
        * because different colorbuffers may have different formats.
        */



More information about the mesa-commit mailing list