static void *
ilo_create_vertex_elements_state(struct pipe_context *pipe,
                                 unsigned num_elements,
                                 const struct pipe_vertex_element *elements)
{
   const struct ilo_dev_info *dev = ilo_context(pipe)->dev;
   struct ilo_ve_state *ve;

   ve = MALLOC_STRUCT(ilo_ve_state);
   assert(ve);

   ilo_gpe_init_ve(dev, num_elements, elements, ve);

   return ve;
}
/**
 * Set the states that are invariant between all ops.
 */
static bool
ilo_blitter_set_invariants(struct ilo_blitter *blitter)
{
    struct pipe_vertex_element velem;
    struct pipe_viewport_state vp;

    if (blitter->initialized)
        return true;

    /* only vertex X and Y */
    memset(&velem, 0, sizeof(velem));
    velem.src_format = PIPE_FORMAT_R32G32_FLOAT;
    ilo_gpe_init_ve(blitter->ilo->dev, 1, &velem, &blitter->ve);

    /* generate VUE header */
    ilo_gpe_init_ve_nosrc(blitter->ilo->dev,
                          GEN6_VFCOMP_STORE_0, /* Reserved */
                          GEN6_VFCOMP_STORE_0, /* Render Target Array Index */
                          GEN6_VFCOMP_STORE_0, /* Viewport Index */
                          GEN6_VFCOMP_STORE_0, /* Point Width */
                          &blitter->ve.nosrc_cso);
    blitter->ve.prepend_nosrc_cso = true;

    /* a rectangle has 3 vertices in a RECTLIST */
    util_draw_init_info(&blitter->draw);
    blitter->draw.mode = ILO_PRIM_RECTANGLES;
    blitter->draw.count = 3;

    /**
     * From the Haswell PRM, volume 7, page 615:
     *
     *     "The clear value must be between the min and max depth values
     *     (inclusive) defined in the CC_VIEWPORT."
     *
     * Even though clipping and viewport transformation will be disabled, we
     * still need to set up the viewport states.
     */
    memset(&vp, 0, sizeof(vp));
    vp.scale[0] = 1.0f;
    vp.scale[1] = 1.0f;
    vp.scale[2] = 1.0f;
    ilo_gpe_set_viewport_cso(blitter->ilo->dev, &vp, &blitter->viewport);

    blitter->initialized = true;

    return true;
}