Module: Mesa
Branch: master
Commit: c5e72eb09daba7a087006f6ade691798f759a23c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5e72eb09daba7a087006f6ade691798f759a23c

Author: Mike Blumenkrantz <[email protected]>
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9344>

---

 src/mesa/state_tracker/st_cb_clear.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_clear.c 
b/src/mesa/state_tracker/st_cb_clear.c
index f714c89e3db..28ce51a936f 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -538,6 +538,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.
        */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to