Mesa (9.1): i965/Gen4: Zero extra coordinates for ir_tex

Carl Worth cworth at kemper.freedesktop.org
Wed Jul 31 05:45:20 UTC 2013


Module: Mesa
Branch: 9.1
Commit: 01b38d489c3dda7814873ba80df7d8918e8bce44
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=01b38d489c3dda7814873ba80df7d8918e8bce44

Author: Chris Forbes <chrisf at ijw.co.nz>
Date:   Sun Jul 14 18:30:52 2013 +1200

i965/Gen4: Zero extra coordinates for ir_tex

We always emit U,V,R coordinates for this message, but the sampler gets
very angry if we pass garbage in the R coordinate for at least some
texture formats.

Fill the remaining coordinates with zero instead.

Fixes broken rendering on GM45 in Source games, and in VDrift.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65236

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit 121ea0b38bfee093e0bde0ff1443fc2efec688b0)

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 3df4966..7276154 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -809,6 +809,10 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
 	 emit(MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate));
 	 coordinate.reg_offset++;
       }
+      /* zero the others. */
+      for (int i = ir->coordinate->type->vector_elements; i<3; i++) {
+         emit(MOV(fs_reg(MRF, base_mrf + mlen + i), fs_reg(0.0f)));
+      }
       /* gen4's SIMD8 sampler always has the slots for u,v,r present. */
       mlen += 3;
    } else if (ir->op == ir_txd) {




More information about the mesa-commit mailing list