Module: Mesa Branch: master Commit: 25cf241540007088936a6df16c849441087f722c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=25cf241540007088936a6df16c849441087f722c
Author: Eric Anholt <e...@anholt.net> Date: Mon Oct 11 13:19:47 2010 -0700 i965: Don't consider gen6 math instructions to write to MRFs. This was leftover from the pre-gen6 cleanups. One tests regresses where compute-to-MRF now occurs. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 55 +++++++++++++++++++++++---------- 1 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 645145d..0f1f4fa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -532,8 +532,10 @@ fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src) } fs_inst *inst = emit(fs_inst(opcode, dst, src)); - inst->base_mrf = 2; - inst->mlen = 1; + if (intel->gen < 6) { + inst->base_mrf = 2; + inst->mlen = 1; + } return inst; } @@ -541,13 +543,20 @@ fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src) fs_inst * fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src0, fs_reg src1) { - assert(opcode == FS_OPCODE_POW); + int base_mrf = 2; + fs_inst *inst; - fs_inst *inst = emit(fs_inst(opcode, dst, src0, src1)); + assert(opcode == FS_OPCODE_POW); - inst->base_mrf = 2; - inst->mlen = 2; + if (intel->gen >= 6) { + inst = emit(fs_inst(opcode, dst, src0, src1)); + } else { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + 1), src1)); + inst = emit(fs_inst(opcode, dst, src0, reg_null)); + inst->base_mrf = base_mrf; + inst->mlen = 2; + } return inst; } @@ -1757,19 +1766,31 @@ fs_visitor::generate_math(fs_inst *inst, break; } - assert(inst->mlen >= 1); + if (intel->gen >= 6) { + assert(inst->mlen == 0); - if (inst->opcode == FS_OPCODE_POW) { - brw_MOV(p, brw_message_reg(inst->base_mrf + 1), src[1]); - } + if (inst->opcode == FS_OPCODE_POW) { + brw_math2(p, dst, op, src[0], src[1]); + } else { + brw_math(p, dst, + op, + inst->saturate ? BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE, + 0, src[0], + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } + } else { + assert(inst->mlen >= 1); - brw_math(p, dst, - op, - inst->saturate ? BRW_MATH_SATURATE_SATURATE : - BRW_MATH_SATURATE_NONE, - inst->base_mrf, src[0], - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); + brw_math(p, dst, + op, + inst->saturate ? BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE, + inst->base_mrf, src[0], + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } } void _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit