mesa/st: no-op scissored clear calls with size zero
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 1 Mar 2021 19:53:50 +0000 (14:53 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 1 Mar 2021 20:27:17 +0000 (20:27 +0000)
Wx0 and 0xH should result in no-ops in the driver, so they can just
become no-ops before they reach the driver to save some validation later

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9344>

src/mesa/state_tracker/st_cb_clear.c

index 28ce51a..87b664c 100644 (file)
@@ -542,6 +542,9 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
          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);
+         if (scissor_state.minx == scissor_state.maxx ||
+             scissor_state.miny == scissor_state.maxy)
+            return;
       }
       /* We can't translate the clear color to the colorbuffer format,
        * because different colorbuffers may have different formats.