summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_quad_stipple.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-12-14 12:25:25 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-12-14 12:25:25 -0700
commit017f862de1f857bca29f09794539aaf411014f13 (patch)
treeb48e4c1cf03529d7b3ec22aac2047bbb5c567cdc /src/mesa/pipe/softpipe/sp_quad_stipple.c
parentf3b3ea9742e6511fa46332c2c6d2433f96cc5c10 (diff)
Added origin_lower_left field to pipe_rasterizer_state
This controls whether the window origin is considered to be the lower-left or upper-left corner. This effects computation of gl_FragCoord and the application of polygon stipple.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_quad_stipple.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/mesa/pipe/softpipe/sp_quad_stipple.c
index 04d95989c4..0c42963dfe 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stipple.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stipple.c
@@ -22,10 +22,18 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
if (quad->prim == PRIM_TRI) {
struct softpipe_context *softpipe = qs->softpipe;
/* need to invert Y to index into OpenGL's stipple pattern */
- const int y0 = softpipe->framebuffer.cbufs[0]->height - 1 - quad->y0;
- const int y1 = y0 - 1;
- const unsigned stipple0 = softpipe->poly_stipple.stipple[y0 % 32];
- const unsigned stipple1 = softpipe->poly_stipple.stipple[y1 % 32];
+ int y0, y1;
+ uint stipple0, stipple1;
+ if (softpipe->rasterizer->origin_lower_left) {
+ y0 = softpipe->framebuffer.cbufs[0]->height - 1 - quad->y0;
+ y1 = y0 - 1;
+ }
+ else {
+ y0 = quad->y0;
+ y1 = y0 + 1;
+ }
+ stipple0 = softpipe->poly_stipple.stipple[y0 % 32];
+ stipple1 = softpipe->poly_stipple.stipple[y1 % 32];
#if 1
const int col0 = quad->x0 % 32;