[Mesa-dev] [PATCH 35/40] i965: Consider all scissor rectangles in noop_scissor

Kenneth Graunke kenneth at whitecape.org
Fri Jan 10 18:11:20 PST 2014


On 01/10/2014 05:40 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> v2: Use '& 1' instead of '& i'.  Noticed by Ken.
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_clear.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
> index 58fd612..19bde0f 100644
> --- a/src/mesa/drivers/dri/i965/brw_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> @@ -83,10 +83,16 @@ debug_mask(const char *name, GLbitfield mask)
>  static bool
>  noop_scissor(struct gl_context *ctx, struct gl_framebuffer *fb)
>  {
> -   return ctx->Scissor.ScissorArray[0].X <= 0 &&
> -          ctx->Scissor.ScissorArray[0].Y <= 0 &&
> -          ctx->Scissor.ScissorArray[0].Width >= fb->Width &&
> -          ctx->Scissor.ScissorArray[0].Height >= fb->Height;
> +   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
> +      if (((ctx->Scissor.EnableFlags >> i) & 1) &&

I would really prefer to see:

if ((ctx->Scissor.EnableFlags & (1 << i)) &&
   ...

It's much more common in our code.

> +          (ctx->Scissor.ScissorArray[i].X > 0 ||
> +           ctx->Scissor.ScissorArray[i].Y > 0 ||
> +           ctx->Scissor.ScissorArray[i].Width < fb->Width ||
> +           ctx->Scissor.ScissorArray[i].Height < fb->Height))
> +         return false;
> +   }
> +
> +   return true;
>  }
>  
>  /**



More information about the mesa-dev mailing list