i965: Share OPCODE_MAD between brw_wm_glsl.c and brw_wm_emit.c
This commit is contained in:
@@ -351,5 +351,11 @@ void emit_lrp(struct brw_compile *p,
|
||||
const struct brw_reg *arg0,
|
||||
const struct brw_reg *arg1,
|
||||
const struct brw_reg *arg2);
|
||||
void emit_mad(struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
const struct brw_reg *arg0,
|
||||
const struct brw_reg *arg1,
|
||||
const struct brw_reg *arg2);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -402,12 +402,12 @@ void emit_alu2(struct brw_compile *p,
|
||||
}
|
||||
|
||||
|
||||
static void emit_mad( struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
const struct brw_reg *arg0,
|
||||
const struct brw_reg *arg1,
|
||||
const struct brw_reg *arg2 )
|
||||
void emit_mad(struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
const struct brw_reg *arg0,
|
||||
const struct brw_reg *arg1,
|
||||
const struct brw_reg *arg2)
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
|
||||
@@ -1214,29 +1214,6 @@ static void emit_kil(struct brw_wm_compile *c)
|
||||
brw_pop_insn_state(p);
|
||||
}
|
||||
|
||||
static void emit_mad(struct brw_wm_compile *c,
|
||||
const struct prog_instruction *inst)
|
||||
{
|
||||
struct brw_compile *p = &c->func;
|
||||
GLuint mask = inst->DstReg.WriteMask;
|
||||
struct brw_reg dst, src0, src1, src2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (mask & (1<<i)) {
|
||||
dst = get_dst_reg(c, inst, i);
|
||||
src0 = get_src_reg(c, inst, 0, i);
|
||||
src1 = get_src_reg_imm(c, inst, 1, i);
|
||||
src2 = get_src_reg_imm(c, inst, 2, i);
|
||||
brw_MUL(p, dst, src0, src1);
|
||||
|
||||
brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
|
||||
brw_ADD(p, dst, dst, src2);
|
||||
brw_set_saturate(p, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void emit_sop(struct brw_wm_compile *c,
|
||||
const struct prog_instruction *inst, GLuint cond)
|
||||
{
|
||||
@@ -2734,7 +2711,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
|
||||
emit_pow(c, inst);
|
||||
break;
|
||||
case OPCODE_MAD:
|
||||
emit_mad(c, inst);
|
||||
emit_mad(p, dst, dst_flags, args[0], args[1], args[2]);
|
||||
break;
|
||||
case OPCODE_NOISE1:
|
||||
emit_noise1(c, inst);
|
||||
|
||||
Reference in New Issue
Block a user