diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 5 |
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 b45035e80f0..a8610eea92a 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 efe90f4ae01..c9c9856748d 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 f1539d5c3a7..55ae6898866 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); |