diff options
author | Eric Anholt <eric@anholt.net> | 2010-11-13 14:00:58 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-11-14 22:35:17 +0800 |
commit | 3b337f5cd94384d2d5918fb630aa8089e49b1d8d (patch) | |
tree | ac7114e2e8956a2cc7690a2092940f308db3a2ff /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | d11db2a857141c556378fde9f9f5ec08c7f8636f (diff) |
i965: Fix gl_FragCoord inversion when drawing to an FBO.
This showed up as cairo-gl gradients being inverted on everyone but
Intel, where I'd apparently tweaked the transformation to work around
the bug. Fixes piglit fbo-fragcoord.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index b24655bf30..4648298c1f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -400,6 +400,7 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) fs_reg wpos = *reg; fs_reg neg_y = this->pixel_y; neg_y.negate = true; + bool flip = !ir->origin_upper_left ^ c->key.render_to_fbo; /* gl_FragCoord.x */ if (ir->pixel_center_integer) { @@ -410,13 +411,13 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) wpos.reg_offset++; /* gl_FragCoord.y */ - if (ir->origin_upper_left && ir->pixel_center_integer) { + if (!flip && ir->pixel_center_integer) { emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); } else { fs_reg pixel_y = this->pixel_y; float offset = (ir->pixel_center_integer ? 0.0 : 0.5); - if (!ir->origin_upper_left) { + if (flip) { pixel_y.negate = true; offset += c->key.drawable_height - 1.0; } |