예제 #1
0
파일: brw_sf_emit.c 프로젝트: soreau/mesa
/* Calculates the predicate control for which channels of a reg
 * (containing 2 attrs) to do point sprite coordinate replacement on.
 */
static uint16_t
calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg)
{
   int vert_result1, vert_result2;
   uint16_t pc = 0;

   vert_result1 = vert_reg_to_vert_result(c, reg, 0);
   if (vert_result1 >= VARYING_SLOT_TEX0 && vert_result1 <= VARYING_SLOT_TEX7) {
      if (c->key.point_sprite_coord_replace & (1 << (vert_result1 - VARYING_SLOT_TEX0)))
	 pc |= 0x0f;
   }
   if (vert_result1 == BRW_VARYING_SLOT_PNTC)
      pc |= 0x0f;

   vert_result2 = vert_reg_to_vert_result(c, reg, 1);
   if (vert_result2 >= VARYING_SLOT_TEX0 && vert_result2 <= VARYING_SLOT_TEX7) {
      if (c->key.point_sprite_coord_replace & (1 << (vert_result2 -
                                                     VARYING_SLOT_TEX0)))
         pc |= 0xf0;
   }
   if (vert_result2 == BRW_VARYING_SLOT_PNTC)
      pc |= 0xf0;

   return pc;
}
예제 #2
0
static bool
calculate_masks(struct brw_sf_compile *c,
	        GLuint reg,
		GLushort *pc,
		GLushort *pc_persp,
		GLushort *pc_linear)
{
   bool is_last_attr = (reg == c->nr_setup_regs - 1);
   GLbitfield64 persp_mask;
   GLbitfield64 linear_mask;

   if (c->key.do_flat_shading)
      persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS) |
                                    BITFIELD64_BIT(VERT_RESULT_COL0) |
                                    BITFIELD64_BIT(VERT_RESULT_COL1));
   else
      persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS));

   if (c->key.do_flat_shading)
      linear_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_COL0) |
                                     BITFIELD64_BIT(VERT_RESULT_COL1));
   else
      linear_mask = c->key.attrs;

   *pc_persp = 0;
   *pc_linear = 0;
   *pc = 0xf;
      
   if (persp_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 0)))
      *pc_persp = 0xf;

   if (linear_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 0)))
      *pc_linear = 0xf;

   /* Maybe only processs one attribute on the final round:
    */
   if (vert_reg_to_vert_result(c, reg, 1) != BRW_VERT_RESULT_MAX) {
      *pc |= 0xf0;

      if (persp_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 1)))
	 *pc_persp |= 0xf0;

      if (linear_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 1)))
	 *pc_linear |= 0xf0;
   }

   return is_last_attr;
}