static void translate_insn(struct brw_wm_compile *c, const struct prog_instruction *inst) { struct brw_wm_instruction *out = get_instruction(c); GLuint writemask = inst->DstReg.WriteMask; GLuint nr_args = brw_wm_nr_args(inst->Opcode); GLuint i, j; /* Copy some data out of the instruction */ out->opcode = inst->Opcode; out->saturate = (inst->SaturateMode != SATURATE_OFF); out->tex_unit = inst->TexSrcUnit; out->tex_idx = inst->TexSrcTarget; out->tex_shadow = inst->TexShadow; out->eot = inst->Aux & INST_AUX_EOT; out->target = INST_AUX_GET_TARGET(inst->Aux); /* Args: */ for (i = 0; i < nr_args; i++) { for (j = 0; j < 4; j++) { out->src[i][j] = get_new_ref(c, inst->SrcReg[i], j, out); } } /* Dst: */ pass0_set_dst(c, out, inst, writemask); }
static struct brw_wm_instruction *translate_insn( struct brw_wm_compile *c, const struct prog_instruction *inst ) { struct brw_wm_instruction *out = get_instruction(c); GLuint writemask = inst->DstReg.WriteMask; GLuint nr_args = brw_wm_nr_args(inst->Opcode); GLuint i, j; /* Copy some data out of the instruction */ out->opcode = inst->Opcode; out->saturate = (inst->SaturateMode != SATURATE_OFF); out->tex_unit = inst->TexSrcUnit; out->tex_idx = inst->TexSrcTarget; /* Args: */ for (i = 0; i < nr_args; i++) { for (j = 0; j < 4; j++) { out->src[i][j] = get_new_ref(c, inst->SrcReg[i], j, out); } } /* Dst: */ if (brw_wm_is_scalar_result(out->opcode)) pass0_set_dst_scalar(c, out, inst, writemask); else pass0_set_dst(c, out, inst, writemask); return out; }
/*********************************************************************** * Optimize moves and swizzles away: */ static void pass0_precalc_mov( struct brw_wm_compile *c, const struct prog_instruction *inst ) { const struct prog_dst_register *dst = &inst->DstReg; GLuint writemask = inst->DstReg.WriteMask; GLuint i; /* Get the effect of a MOV by manipulating our register table: */ for (i = 0; i < 4; i++) { if (writemask & (1<<i)) { pass0_set_fpreg_ref( c, dst->File, dst->Index, i, get_new_ref(c, inst->SrcReg[0], i, NULL)); } } }
/*********************************************************************** * Optimize moves and swizzles away: */ static void pass0_precalc_mov( struct brw_wm_compile *c, const struct prog_instruction *inst ) { const struct prog_dst_register *dst = &inst->DstReg; GLuint writemask = inst->DstReg.WriteMask; struct brw_wm_ref *refs[4]; GLuint i; /* Get the effect of a MOV by manipulating our register table: * First get all refs, then assign refs. This ensures that "in-place" * swizzles such as: * MOV t, t.xxyx * are handled correctly. Previously, these two steps were done in * one loop and the above case was incorrectly handled. */ for (i = 0; i < 4; i++) { refs[i] = get_new_ref(c, inst->SrcReg[0], i, NULL); } for (i = 0; i < 4; i++) { if (writemask & (1 << i)) { pass0_set_fpreg_ref( c, dst->File, dst->Index, i, refs[i]); } } }