state_tracker: Fix check for scissor enabled when < 0.
authorEric Anholt <eric@anholt.net>
Fri, 14 Oct 2016 22:15:13 +0000 (15:15 -0700)
committerEric Anholt <eric@anholt.net>
Sun, 16 Oct 2016 18:22:50 +0000 (11:22 -0700)
DEQP's clear tests like to give us x + w < 0 or y + h < 0.  Since we
were comparing to an unsigned, it would get promoted to unsigned and come
out as bignum >= width or height and we would clear the whole fb instead
of none of the fb.

Fixes 10 tests under deqp-gles2/functional/color_clear.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_clear.c

index 813ba9b10ffad2cc5b58aab0e2c81faaae668117..158efc186c050a0112e18f566ea4172feac89062 100644 (file)
@@ -318,8 +318,8 @@ is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
    return (ctx->Scissor.EnableFlags & 1) &&
           (scissor->X > 0 ||
            scissor->Y > 0 ||
-           scissor->X + scissor->Width < rb->Width ||
-           scissor->Y + scissor->Height < rb->Height);
+           scissor->X + scissor->Width < (int)rb->Width ||
+           scissor->Y + scissor->Height < (int)rb->Height);
 }
 
 /**