Mesa (9.0): i965/vs: Store texturing results into a vec4 temporary.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jan 31 00:22:15 UTC 2013


Module: Mesa
Branch: 9.0
Commit: bc7112746d4663b814aab018c8c1fb97af03fb42
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc7112746d4663b814aab018c8c1fb97af03fb42

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Jan 16 20:24:13 2013 -0800

i965/vs: Store texturing results into a vec4 temporary.

The sampler appears to ignore writemasks (even when correcting the
WRITEMASK_XYZW in brw_vec4_emit.cpp to the proper writemask) and just
always writes all four values.

To cope with this, just texture into a temporary, then MOV out into a
register that has the proper number of components.

NOTE: This is a candidate for stable branches.

Fixes es3conform's shadow_execution_vert.test.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <idr at freedesktop.org>
(cherry picked from commit f0dbd9255b5813d1567e1f09266f80e35dcbeb70)

---

 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index ed04c8f..6f6b4ba 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1905,6 +1905,7 @@ vec4_visitor::visit(ir_texture *ir)
    inst->mlen = inst->header_present + 1; /* always at least one */
    inst->sampler = sampler;
    inst->dst = dst_reg(this, ir->type);
+   inst->dst.writemask = WRITEMASK_XYZW;
    inst->shadow_compare = ir->shadow_comparitor != NULL;
 
    if (ir->offset != NULL && ir->op != ir_txf)
@@ -2010,13 +2011,16 @@ vec4_visitor::visit(ir_texture *ir)
 void
 vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
 {
-   this->result = orig_val;
-
    int s = c->key.tex.swizzles[sampler];
 
+   this->result = src_reg(this, ir->type);
+   dst_reg swizzled_result(this->result);
+
    if (ir->op == ir_txs || ir->type == glsl_type::float_type
-			|| s == SWIZZLE_NOOP)
+			|| s == SWIZZLE_NOOP) {
+      emit(MOV(swizzled_result, orig_val));
       return;
+   }
 
    int zero_mask = 0, one_mask = 0, copy_mask = 0;
    int swizzle[4];
@@ -2036,9 +2040,6 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
       }
    }
 
-   this->result = src_reg(this, ir->type);
-   dst_reg swizzled_result(this->result);
-
    if (copy_mask) {
       orig_val.swizzle = BRW_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
       swizzled_result.writemask = copy_mask;




More information about the mesa-commit mailing list