summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/p_state.h1
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c16
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c2
4 files changed, 26 insertions, 7 deletions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 43b710ff3b..af65d365bf 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -94,6 +94,7 @@ struct pipe_rasterizer_state
unsigned line_stipple_factor:8; /**< [1..256] actually */
unsigned line_stipple_pattern:16;
unsigned bypass_clipping:1;
+ unsigned origin_lower_left:1; /**< Is (0,0) the lower-left corner? */
float line_width;
float point_size; /**< used when no per-vertex size */
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 8d8dceadc5..2ccf5e2624 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -480,15 +480,23 @@ static void tri_persp_coeff( struct setup_stage *setup,
static void
setup_fragcoord_coeff(struct setup_stage *setup)
{
- const int winHeight = setup->softpipe->framebuffer.cbufs[0]->height;
/*X*/
setup->coef[0].a0[0] = 0;
setup->coef[0].dadx[0] = 1.0;
setup->coef[0].dady[0] = 0.0;
/*Y*/
- setup->coef[0].a0[1] = winHeight - 1;
+ if (setup->softpipe->rasterizer->origin_lower_left) {
+ /* y=0=bottom */
+ const int winHeight = setup->softpipe->framebuffer.cbufs[0]->height;
+ setup->coef[0].a0[1] = winHeight - 1;
+ setup->coef[0].dady[1] = -1.0;
+ }
+ else {
+ /* y=0=top */
+ setup->coef[0].a0[1] = 0.0;
+ setup->coef[0].dady[1] = 1.0;
+ }
setup->coef[0].dadx[1] = 0.0;
- setup->coef[0].dady[1] = -1.0;
/*Z*/
setup->coef[0].a0[2] = setup->posCoef.a0[2];
setup->coef[0].dadx[2] = setup->posCoef.dadx[2];
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;
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 2a7128dd27..5c6b89d78c 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -77,6 +77,8 @@ static void update_raster_state( struct st_context *st )
uint i;
memset(&raster, 0, sizeof(raster));
+
+ raster.origin_lower_left = 1; /* Always true for OpenGL */
/* _NEW_POLYGON, _NEW_BUFFERS
*/