Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
static void brw_wm_print_fp_insn( struct brw_wm_compile *c,
                                  struct brw_fp_instruction *inst )
{
   GLuint i;
   GLuint nr_args = brw_wm_nr_args(inst->opcode);

   print_opcode(inst->opcode);
   if (inst->dst.saturate)
      debug_printf("_SAT");
   debug_printf(" ");

   if (inst->dst.indirect)
      debug_printf("[");

   debug_printf("%s[%d]",
                file_strings[inst->dst.file],
                inst->dst.index );
   print_writemask(inst->dst.writemask);

   if (inst->dst.indirect)
      debug_printf("]");

   debug_printf(nr_args ? ", " : "\n");
   
   for (i = 0; i < nr_args; i++) {
      debug_printf("%s%s%s[%d]%s",
                   inst->src[i].negate ? "-" : "",
                   inst->src[i].abs ? "ABS(" : "",
                   file_strings[inst->src[i].file],
                   inst->src[i].index,
                   inst->src[i].abs ? ")" : "");
      print_swizzle(inst->src[i].swizzle);
      debug_printf("%s", i == nr_args - 1 ? "\n" : ", ");
   }
}
Exemplo n.º 4
0
static void validate_src_regs( struct brw_wm_compile *c,
			       const struct prog_instruction *inst )
{
   GLuint nr_args = brw_wm_nr_args( inst->Opcode );
   GLuint i;

   for (i = 0; i < nr_args; i++) {
      if (inst->SrcReg[i].File == PROGRAM_INPUT) {
	 GLuint idx = inst->SrcReg[i].Index;
	 if (!(c->fp_interp_emitted & (1<<idx))) {
	    emit_interp(c, idx);
	 }
      }
   }
}
Exemplo n.º 5
0
void brw_wm_print_insn( struct brw_wm_compile *c,
			struct brw_wm_instruction *inst )
{
   GLuint i, arg;
   GLuint nr_args = brw_wm_nr_args(inst->opcode);

   debug_printf("[");
   for (i = 0; i < 4; i++) {
      if (inst->dst[i]) {
	 brw_wm_print_value(c, inst->dst[i]);
	 if (inst->dst[i]->spill_slot)
	    debug_printf("/SPILL(%x)",inst->dst[i]->spill_slot);
      }
      else
	 debug_printf("#");
      if (i < 3)      
	 debug_printf(",");
   }
   debug_printf("]");
   print_writemask(inst->writemask);
   
   debug_printf(" = ");
   print_opcode(inst->opcode);
  
   if (inst->saturate)
      debug_printf("_SAT");

   for (arg = 0; arg < nr_args; arg++) {

      debug_printf(" [");

      for (i = 0; i < 4; i++) {
	 if (inst->src[arg][i]) {
	    brw_wm_print_ref(c, inst->src[arg][i]);
	 }
	 else
	    debug_printf("%%");

	 if (i < 3) 
	    debug_printf(",");
	 else
	    debug_printf("]");
      }
   }
   debug_printf("\n");
}
Exemplo n.º 6
0
void brw_wm_print_insn( struct brw_wm_compile *c,
			struct brw_wm_instruction *inst )
{
   GLuint i, arg;
   GLuint nr_args = brw_wm_nr_args(inst->opcode);

   printf("[");
   for (i = 0; i < 4; i++) {
      if (inst->dst[i]) {
	 brw_wm_print_value(c, inst->dst[i]);
	 if (inst->dst[i]->spill_slot)
	    printf("/SPILL(%x)",inst->dst[i]->spill_slot);
      }
      else
	 printf("#");
      if (i < 3)      
	 printf(",");
   }
   printf("]");

   if (inst->writemask != WRITEMASK_XYZW)
      printf(".%s%s%s%s", 
		   GET_BIT(inst->writemask, 0) ? "x" : "",
		   GET_BIT(inst->writemask, 1) ? "y" : "",
		   GET_BIT(inst->writemask, 2) ? "z" : "",
		   GET_BIT(inst->writemask, 3) ? "w" : "");

   switch (inst->opcode) {
   case WM_PIXELXY:
      printf(" = PIXELXY");
      break;
   case WM_DELTAXY:
      printf(" = DELTAXY");
      break;
   case WM_PIXELW:
      printf(" = PIXELW");
      break;
   case WM_WPOSXY:
      printf(" = WPOSXY");
      break;
   case WM_PINTERP:
      printf(" = PINTERP");
      break;
   case WM_LINTERP:
      printf(" = LINTERP");
      break;
   case WM_CINTERP:
      printf(" = CINTERP");
      break;
   case WM_FB_WRITE:
      printf(" = FB_WRITE");
      break;
   case WM_FRONTFACING:
      printf(" = FRONTFACING");
      break;
   default:
      printf(" = %s", _mesa_opcode_string(inst->opcode));
      break;
   }

   if (inst->saturate)
      printf("_SAT");

   for (arg = 0; arg < nr_args; arg++) {

      printf(" [");

      for (i = 0; i < 4; i++) {
	 if (inst->src[arg][i]) {
	    brw_wm_print_ref(c, inst->src[arg][i]);
	 }
	 else
	    printf("%%");

	 if (i < 3) 
	    printf(",");
	 else
	    printf("]");
      }
   }
   printf("\n");
}