summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-09-09 15:36:59 -0700
committerKenneth Graunke <[email protected]>2013-09-10 17:52:36 -0700
commit17eb1df7b8af800f03c5b1f35fdf4292abe32ea1 (patch)
tree3a51b11224a2d04d1d426ba3d135780b015c9f57 /src/mesa/drivers
parent66be7b4c2795b5a942f64821fc6525dfdfb3aba4 (diff)
i965/vec4: Simplify the computation of coord_mask and zero_mask.
We can easily compute these without loops, resulting in simpler and shorter code. Signed-off-by: Kenneth Graunke <[email protected]> Suggested-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 28dc313e431..a51b61baf03 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2221,13 +2221,10 @@ vec4_visitor::visit(ir_texture *ir)
int writemask = brw->gen == 4 ? WRITEMASK_W : WRITEMASK_X;
emit(MOV(dst_reg(MRF, param_base, lod_type, writemask), lod));
} else {
- int i, coord_mask = 0, zero_mask = 0;
/* Load the coordinate */
/* FINISHME: gl_clamp_mask and saturate */
- for (i = 0; i < ir->coordinate->type->vector_elements; i++)
- coord_mask |= (1 << i);
- for (; i < 4; i++)
- zero_mask |= (1 << i);
+ int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1;
+ int zero_mask = 0xf & ~coord_mask;
if (ir->offset && ir->op == ir_txf) {
/* It appears that the ld instruction used for txf does its