i965: When producing a single channel swizzle, don't make a temporary.
authorEric Anholt <eric@anholt.net>
Fri, 1 Oct 2010 22:42:39 +0000 (15:42 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 2 Oct 2010 00:19:03 +0000 (17:19 -0700)
This quickly cuts 8% of the instructions in my glsl demo.

src/mesa/drivers/dri/i965/brw_fs.cpp

index 50341ba..b38df71 100644 (file)
@@ -1445,6 +1445,11 @@ fs_visitor::visit(ir_swizzle *ir)
    ir->val->accept(this);
    fs_reg val = this->result;
 
+   if (ir->type->vector_elements == 1) {
+      this->result.reg_offset += ir->mask.x;
+      return;
+   }
+
    fs_reg result = fs_reg(this, ir->type);
    this->result = result;