summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-10-01 15:42:39 -0700
committerEric Anholt <eric@anholt.net>2010-10-01 17:19:03 -0700
commit5ee09413162f4ec83cc7a738e807ffde8c89cca7 (patch)
tree073135978b6e0cb2d379f8cd6ca53d60b3d7cf23 /src/mesa
parenta0799725f52386cef911d3e104c5514a2811290b (diff)
i965: When producing a single channel swizzle, don't make a temporary.
This quickly cuts 8% of the instructions in my glsl demo.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 50341ba383..b38df71a84 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;