Пример #1
0
static void
gen8_draw_vf(struct ilo_render *r,
             const struct ilo_state_vector *vec,
             struct ilo_render_draw_session *session)
{
   /* 3DSTATE_INDEX_BUFFER */
   if ((session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_INDEX_BUFFER) ||
       DIRTY(IB) || r->batch_bo_changed)
      gen8_3DSTATE_INDEX_BUFFER(r->builder, &vec->ve->vf, &vec->ib.ib);

   /* 3DSTATE_VF */
   if (session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_VF)
      gen75_3DSTATE_VF(r->builder, &vec->ve->vf);

   /* 3DSTATE_VERTEX_BUFFERS */
   if ((session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_VERTEX_BUFFERS) ||
       DIRTY(VB) || DIRTY(VE) || r->batch_bo_changed) {
      gen6_3DSTATE_VERTEX_BUFFERS(r->builder, &vec->ve->vf,
            vec->vb.vb, vec->ve->vb_count);
   }

   /* 3DSTATE_VERTEX_ELEMENTS */
   if (session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_VERTEX_ELEMENTS)
      gen6_3DSTATE_VERTEX_ELEMENTS(r->builder, &vec->ve->vf);

   gen8_3DSTATE_VF_TOPOLOGY(r->builder, vec->draw_info.topology);

   if (session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_VF_INSTANCING) {
      const uint8_t attr_count = ilo_state_vf_get_attr_count(&vec->ve->vf);
      uint8_t i;

      for (i = 0; i < attr_count; i++)
         gen8_3DSTATE_VF_INSTANCING(r->builder, &vec->ve->vf, i);
   }

   if (session->vf_delta.dirty & ILO_STATE_VF_3DSTATE_VF_SGVS)
      gen8_3DSTATE_VF_SGVS(r->builder, &vec->ve->vf);
}
static void
gen8_draw_vf(struct ilo_render *r,
             const struct ilo_state_vector *vec,
             struct ilo_render_draw_session *session)
{
   int i;

   /* 3DSTATE_INDEX_BUFFER */
   if (DIRTY(IB) || r->batch_bo_changed)
      gen8_3DSTATE_INDEX_BUFFER(r->builder, &vec->ib);

   /* 3DSTATE_VF */
   if (session->primitive_restart_changed) {
      gen75_3DSTATE_VF(r->builder, vec->draw->primitive_restart,
            vec->draw->restart_index);
   }

   /* 3DSTATE_VERTEX_BUFFERS */
   if (DIRTY(VB) || DIRTY(VE) || r->batch_bo_changed)
      gen6_3DSTATE_VERTEX_BUFFERS(r->builder, vec->ve, &vec->vb);

   /* 3DSTATE_VERTEX_ELEMENTS */
   if (DIRTY(VE))
      gen6_3DSTATE_VERTEX_ELEMENTS(r->builder, vec->ve);

   gen8_3DSTATE_VF_TOPOLOGY(r->builder, vec->draw->mode);

   for (i = 0; i < vec->ve->vb_count; i++) {
      gen8_3DSTATE_VF_INSTANCING(r->builder, i,
            vec->ve->instance_divisors[i]);
   }

   gen8_3DSTATE_VF_SGVS(r->builder,
         false, 0, 0,
         false, 0, 0);
}