diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 5 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 7f2874d9258..382a54aec47 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -316,9 +316,14 @@ fs_visitor::emit_fragment_program_code() case OPCODE_MAD: for (int i = 0; i < 4; i++) { if (fpi->DstReg.WriteMask & (1 << i)) { - fs_reg temp = vgrf(glsl_type::float_type); - emit(MUL(temp, offset(src[0], i), offset(src[1], i))); - emit(ADD(offset(dst, i), temp, offset(src[2], i))); + if (brw->gen >= 6) { + emit(MAD(offset(dst, i), offset(src[2], i), + offset(src[1], i), offset(src[0], i))); + } else { + fs_reg temp = vgrf(glsl_type::float_type); + emit(MUL(temp, offset(src[0], i), offset(src[1], i))); + emit(ADD(offset(dst, i), temp, offset(src[2], i))); + } } } break; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index c7f321fe65d..a7601149d36 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -456,11 +456,6 @@ fs_visitor::try_emit_mad(ir_expression *ir) return false; } - if (nonmul->as_constant() || - mul->operands[0]->as_constant() || - mul->operands[1]->as_constant()) - return false; - nonmul->accept(this); fs_reg src0 = this->result; |