Mesa (master): i965/fs: Fix projector==1.0 optimization pre-gen6.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jan 9 11:07:40 PST 2012


Module: Mesa
Branch: master
Commit: 30f86aec01e1e1df4265d10a4618e34e9b8fec95
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=30f86aec01e1e1df4265d10a4618e34e9b8fec95

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan  5 17:07:55 2012 -0800

i965/fs: Fix projector==1.0 optimization pre-gen6.

The optimization was supposed to turn an attribute component that was
always 1.0 into a mov of 1.0.  But by leaving loop this patch removes
out of that test, we applied the projection correction to the 1.0 and
got some other value, breaking openarena once it was converted to
using the new compiler backend.

Originally this hunk was separate from the former loop to make the
generated instructions slightly better pipelined.  We now have
automatic instruction scheduling to handle that, and the generated
instruction sequence looked the same to me after this change (except
for the bugfix).

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b6aa60e..40327ac 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -491,17 +491,13 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
                   emit(FS_OPCODE_LINTERP, attr,
                        this->delta_x[barycoord_mode],
                        this->delta_y[barycoord_mode], fs_reg(interp));
+		  if (intel->gen < 6) {
+		     emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
+		  }
 	       }
 	       attr.reg_offset++;
 	    }
 
-	    if (intel->gen < 6) {
-	       attr.reg_offset -= type->vector_elements;
-	       for (unsigned int k = 0; k < type->vector_elements; k++) {
-		  emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
-		  attr.reg_offset++;
-	       }
-	    }
 	 }
 	 location++;
       }



More information about the mesa-commit mailing list