summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-01-26 13:08:42 -0800
committerEric Anholt <eric@anholt.net>2010-01-26 13:30:26 -0800
commitf62c2a0bb89041567467a6c01cf1eb27cec01e9e (patch)
tree77c6654bd9db37fab32f0c8780c15511694034e9 /src/mesa/drivers
parent11c581c6ce0b09dc4203a7f93ebb8f76357f19be (diff)
i965: Fix fp fragment.position handling and enable HW part of ARB_fcc.
As with swrast, this fixes the default pixel center behavior which was broken, and implements the previous behavior for integer. Fixes piglit fp-arb-fragment-coord-conventions-none. The extension won't be exposed until we get the GLSL part implemented. The DRI1 origin_x/y parts are dropped since they're no longer relevant.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c44
3 files changed, 35 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 8afd1f4aef..9191c81755 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -336,11 +336,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
* drawable height in order to invert the Y axis.
*/
if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) {
- if (brw->intel.driDrawable != NULL) {
- key->origin_x = brw->intel.driDrawable->x;
- key->origin_y = brw->intel.driDrawable->y;
- key->drawable_height = brw->intel.driDrawable->h;
- }
+ key->drawable_height = ctx->DrawBuffer->Height;
}
key->nr_color_regions = brw->state.nr_color_regions;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index b9b987ea70..88d84ee82f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -76,7 +76,6 @@ struct brw_wm_prog_key {
GLushort tex_swizzles[BRW_MAX_TEX_UNIT];
- GLushort origin_x, origin_y;
GLushort drawable_height;
GLbitfield64 vp_outputs_written;
GLuint program_string_id:32;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index f316e0cda4..fa0898c586 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -138,19 +138,43 @@ void emit_wpos_xy(struct brw_wm_compile *c,
* X and Y channels.
*/
if (mask & WRITEMASK_X) {
- /* X' = X - origin */
- brw_ADD(p,
- dst[0],
- retype(arg0[0], BRW_REGISTER_TYPE_W),
- brw_imm_d(0 - c->key.origin_x));
+ if (c->fp->program.PixelCenterInteger) {
+ /* X' = X */
+ brw_MOV(p,
+ dst[0],
+ retype(arg0[0], BRW_REGISTER_TYPE_W));
+ } else {
+ /* X' = X + 0.5 */
+ brw_ADD(p,
+ dst[0],
+ retype(arg0[0], BRW_REGISTER_TYPE_W),
+ brw_imm_f(0.5));
+ }
}
if (mask & WRITEMASK_Y) {
- /* Y' = height - (Y - origin_y) = height + origin_y - Y */
- brw_ADD(p,
- dst[1],
- negate(retype(arg0[1], BRW_REGISTER_TYPE_W)),
- brw_imm_d(c->key.origin_y + c->key.drawable_height - 1));
+ if (c->fp->program.OriginUpperLeft) {
+ if (c->fp->program.PixelCenterInteger) {
+ /* Y' = Y */
+ brw_MOV(p,
+ dst[1],
+ retype(arg0[1], BRW_REGISTER_TYPE_W));
+ } else {
+ /* Y' = Y + 0.5 */
+ brw_ADD(p,
+ dst[1],
+ retype(arg0[1], BRW_REGISTER_TYPE_W),
+ brw_imm_f(0.5));
+ }
+ } else {
+ float center_offset = c->fp->program.PixelCenterInteger ? 0.0 : 0.5;
+
+ /* Y' = (height - 1) - Y + center */
+ brw_ADD(p,
+ dst[1],
+ negate(retype(arg0[1], BRW_REGISTER_TYPE_W)),
+ brw_imm_f(c->key.drawable_height - 1 + center_offset));
+ }
}
}