Mesa (master): i965: Use the lowering pass for texture projection.

Eric Anholt anholt at kemper.freedesktop.org
Fri Oct 1 03:24:21 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Sep 30 20:09:53 2010 -0700

i965: Use the lowering pass for texture projection.

We should end up with the same code, but anyone else with this issue
could share the handling (which I got wrong for shadow comparisons in
the driver before).

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0a77b5a..c49b27b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -138,6 +138,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
 	 do_div_to_mul_rcp(shader->ir);
 	 do_sub_to_add_neg(shader->ir);
 	 do_explog_to_explog2(shader->ir);
+	 do_lower_texture_projection(shader->ir);
 
 	 do {
 	    progress = false;
@@ -1229,22 +1230,8 @@ fs_visitor::visit(ir_texture *ir)
    ir->coordinate->accept(this);
    fs_reg coordinate = this->result;
 
-   if (ir->projector) {
-      fs_reg inv_proj = fs_reg(this, glsl_type::float_type);
-
-      ir->projector->accept(this);
-      emit(fs_inst(FS_OPCODE_RCP, inv_proj, this->result));
-
-      fs_reg proj_coordinate = fs_reg(this, ir->coordinate->type);
-      for (unsigned int i = 0; i < ir->coordinate->type->vector_elements; i++) {
-	 emit(fs_inst(BRW_OPCODE_MUL, proj_coordinate, coordinate, inv_proj));
-	 coordinate.reg_offset++;
-	 proj_coordinate.reg_offset++;
-      }
-      proj_coordinate.reg_offset = 0;
-
-      coordinate = proj_coordinate;
-   }
+   /* Should be lowered by do_lower_texture_projection */
+   assert(!ir->projector);
 
    for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) {
       emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate));




More information about the mesa-commit mailing list