summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_prim_setup.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_prim_setup.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_prim_setup.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c14
1 files changed, 11 insertions, 3 deletions
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];