From 0edd490a96a53f83d2fb18a570cf20a4a0c5ee40 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 16 Oct 2007 17:36:37 -0600 Subject: [PATCH] Redefine QUAD_TOP_LEFT, TOP_RIGHT, etc. to reflect Y=0=TOP raster layout. --- src/mesa/pipe/softpipe/sp_headers.h | 19 ++++++++++--------- src/mesa/pipe/softpipe/sp_prim_setup.c | 12 ++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/mesa/pipe/softpipe/sp_headers.h index b377c347125..e23742f8034 100644 --- a/src/mesa/pipe/softpipe/sp_headers.h +++ b/src/mesa/pipe/softpipe/sp_headers.h @@ -39,17 +39,18 @@ /* The rasterizer generates 2x2 quads of fragment and feeds them to - * the current fp_machine (see below). + * the current fp_machine (see below). + * Remember that Y=0=top with Y increasing down the window. */ -#define QUAD_BOTTOM_LEFT 0 -#define QUAD_BOTTOM_RIGHT 1 -#define QUAD_TOP_LEFT 2 -#define QUAD_TOP_RIGHT 3 +#define QUAD_TOP_LEFT 0 +#define QUAD_TOP_RIGHT 1 +#define QUAD_BOTTOM_LEFT 2 +#define QUAD_BOTTOM_RIGHT 3 -#define MASK_BOTTOM_LEFT 0x1 -#define MASK_BOTTOM_RIGHT 0x2 -#define MASK_TOP_LEFT 0x4 -#define MASK_TOP_RIGHT 0x8 +#define MASK_TOP_LEFT (1 << QUAD_TOP_LEFT) +#define MASK_TOP_RIGHT (1 << QUAD_TOP_RIGHT) +#define MASK_BOTTOM_LEFT (1 << QUAD_BOTTOM_LEFT) +#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT) #define MASK_ALL 0xf diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index 7c81faf9df5..598c2f6c228 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -125,11 +125,11 @@ quad_clip(struct setup_stage *setup) if (setup->quad.x0 < minx) setup->quad.mask &= (MASK_BOTTOM_RIGHT | MASK_TOP_RIGHT); if (setup->quad.y0 < miny) - setup->quad.mask &= (MASK_TOP_LEFT | MASK_TOP_RIGHT); + setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_BOTTOM_RIGHT); if (setup->quad.x0 == maxx - 1) setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_TOP_LEFT); if (setup->quad.y0 == maxy - 1) - setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_BOTTOM_RIGHT); + setup->quad.mask &= (MASK_TOP_LEFT | MASK_TOP_RIGHT); } @@ -184,16 +184,16 @@ static unsigned calculate_mask( struct setup_stage *setup, unsigned mask = 0; if (x >= setup->span.left[0] && x < setup->span.right[0]) - mask |= MASK_BOTTOM_LEFT; + mask |= MASK_TOP_LEFT; if (x >= setup->span.left[1] && x < setup->span.right[1]) - mask |= MASK_TOP_LEFT; + mask |= MASK_BOTTOM_LEFT; if (x+1 >= setup->span.left[0] && x+1 < setup->span.right[0]) - mask |= MASK_BOTTOM_RIGHT; + mask |= MASK_TOP_RIGHT; if (x+1 >= setup->span.left[1] && x+1 < setup->span.right[1]) - mask |= MASK_TOP_RIGHT; + mask |= MASK_BOTTOM_RIGHT; return mask; } -- 2.30.2