summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wong <gtw@gnu.org>2008-09-29 09:06:39 -0400
committerGary Wong <gtw@gnu.org>2008-09-29 09:06:39 -0400
commit3239ec474e3542a49a929bfbf9af9413d9eab3d5 (patch)
treec439b8aec07ef3b7c8ae57bfd9e73695e36e15bb
parent052eef31b612f2ac1f7c812fc06b688e83a10fbc (diff)
Fix fragment.position in textured CopyPixels.
(The previous code was bug-compatible with fragment.position being computed in screen coords instead of window coords (bug #9151). Since that was fixed, in commit 9c8f27ba1366da07e20e86a0d48341ea97f5cda4, the meta-op fragment program must be updated to correctly use window coords as well.)
-rw-r--r--src/mesa/drivers/dri/i965/brw_metaops.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_metaops.c b/src/mesa/drivers/dri/i965/brw_metaops.c
index cd6d287aa0..c2f93a7f4f 100644
--- a/src/mesa/drivers/dri/i965/brw_metaops.c
+++ b/src/mesa/drivers/dri/i965/brw_metaops.c
@@ -145,8 +145,8 @@ static const char *fp_prog =
static const char *fp_tex_prog =
"!!ARBfp1.0\n"
"TEMP a;\n"
- "ADD a, fragment.position, program.local[0];\n"
- "MUL a, a, program.local[1];\n"
+ "MUL a, fragment.position, program.local[0];\n"
+ "ADD a, a, program.local[1];\n"
"TEX result.color, a, texture[0], 2D;\n"
"MOV result.depth.z, fragment.position;\n"
"END\n";
@@ -339,16 +339,20 @@ static void meta_frame_buffer_texture( struct intel_context *intel,
instead of brw->attribs.FragmentProgram. */
intel->ctx.FragmentProgram.Current = brw->metaops.fp_tex;
- brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 0 ] = xoff;
- brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 1 ] = yoff;
+ brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 0 ] =
+ 1.0 / region->pitch;
+ brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 1 ] =
+ -1.0 / region->height;
brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 2 ] = 0.0;
- brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 3 ] = 0.0;
+ brw->metaops.fp_tex->Base.LocalParams[ 0 ][ 3 ] = 1.0;
+
brw->metaops.fp_tex->Base.LocalParams[ 1 ][ 0 ] =
- 1.0 / region->pitch;
+ ( intel->driDrawable->x + xoff + 0.5 ) / region->pitch;
brw->metaops.fp_tex->Base.LocalParams[ 1 ][ 1 ] =
- -1.0 / region->height;
+ ( intel->driDrawable->y + intel->driDrawable->h - yoff - 0.5 ) /
+ region->height;
brw->metaops.fp_tex->Base.LocalParams[ 1 ][ 2 ] = 0.0;
- brw->metaops.fp_tex->Base.LocalParams[ 1 ][ 3 ] = 1.0;
+ brw->metaops.fp_tex->Base.LocalParams[ 1 ][ 3 ] = 0.0;
brw->state.dirty.mesa |= _NEW_PROGRAM;
}