summaryrefslogtreecommitdiff
authorEric Anholt <eric@anholt.net>2013-04-26 03:20:05 (GMT)
committer Eric Anholt <eric@anholt.net>2013-04-29 18:41:35 (GMT)
commit61ca2c4f73f84eec29454698188309ab311eb503 (patch) (side-by-side diff)
tree4e8017f1e796ac34a3d1ef6bcdc080ea38fccd79
parentde7e8b1d014aaecf87c2b26e8ab7e89266d5e176 (diff)
downloadmesa-61ca2c4f73f84eec29454698188309ab311eb503.zip
mesa-61ca2c4f73f84eec29454698188309ab311eb503.tar.gz
i965/fs: Allow LRPs with uniform registers.
Improves GLB2.7 performance on my HSW by 0.671455% +/- 0.225037% (n=62). v2: Make is_valid_3src() a method of the fs_reg. (recommended by Ken) Reviewed-by: Matt Turner <mattst88@gmail.com> (v1) Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp5
3 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b45035e..a8610ee 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -444,6 +444,12 @@ fs_reg::is_one() const
return type == BRW_REGISTER_TYPE_F ? imm.f == 1.0 : imm.i == 1;
}
+bool
+fs_reg::is_valid_3src() const
+{
+ return file == GRF || file == UNIFORM;
+}
+
int
fs_visitor::type_size(const struct glsl_type *type)
{
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index efe90f4..c9c9856 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -93,6 +93,7 @@ public:
bool equals(const fs_reg &r) const;
bool is_zero() const;
bool is_one() const;
+ bool is_valid_3src() const;
/** Register file: ARF, GRF, MRF, IMM. */
enum register_file file;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index f1539d5..55ae689 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -201,7 +201,10 @@ fs_visitor::visit(ir_dereference_array *ir)
void
fs_visitor::emit_lrp(fs_reg dst, fs_reg x, fs_reg y, fs_reg a)
{
- if (intel->gen < 6 || x.file != GRF || y.file != GRF || a.file != GRF) {
+ if (intel->gen < 6 ||
+ !x.is_valid_3src() ||
+ !y.is_valid_3src() ||
+ !a.is_valid_3src()) {
/* We can't use the LRP instruction. Emit x*(1-a) + y*a. */
fs_reg y_times_a = fs_reg(this, glsl_type::float_type);
fs_reg one_minus_a = fs_reg(this, glsl_type::float_type);