From: Eric Anholt Date: Fri, 1 Oct 2010 22:42:39 +0000 (-0700) Subject: i965: When producing a single channel swizzle, don't make a temporary. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ee09413162f4ec83cc7a738e807ffde8c89cca7;p=mesa.git i965: When producing a single channel swizzle, don't make a temporary. This quickly cuts 8% of the instructions in my glsl demo. --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 50341ba3835..b38df71a84a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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;