Mesa (master): i965: When producing a single channel swizzle, don' t make a temporary.

Eric Anholt anholt at kemper.freedesktop.org
Sat Oct 2 00:38:13 UTC 2010


Module: Mesa
Branch: master
Commit: 5ee09413162f4ec83cc7a738e807ffde8c89cca7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ee09413162f4ec83cc7a738e807ffde8c89cca7

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Oct  1 15:42:39 2010 -0700

i965: When producing a single channel swizzle, don't make a temporary.

This quickly cuts 8% of the instructions in my glsl demo.

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |    5 +++++
 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 50341ba..b38df71 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;
 




More information about the mesa-commit mailing list