Exemplo n.º 1
0
/**
 * Create a command parser.
 */
struct ilo_cp *
ilo_cp_create(const struct ilo_dev *dev,
              struct intel_winsys *winsys,
              struct ilo_shader_cache *shc)
{
   struct ilo_cp *cp;

   cp = CALLOC_STRUCT(ilo_cp);
   if (!cp)
      return NULL;

   cp->winsys = winsys;
   cp->shader_cache = shc;
   cp->render_ctx = intel_winsys_create_context(winsys);
   if (!cp->render_ctx) {
      FREE(cp);
      return NULL;
   }

   cp->ring = INTEL_RING_RENDER;
   cp->owner = &ilo_cp_default_owner;

   ilo_builder_init(&cp->builder, dev, winsys);

   if (!ilo_builder_begin(&cp->builder)) {
      ilo_cp_destroy(cp);
      return NULL;
   }

   return cp;
}
Exemplo n.º 2
0
/**
 * Create a command parser.
 */
struct ilo_cp *
ilo_cp_create(struct intel_winsys *winsys, bool direct_map)
{
    struct ilo_cp *cp;

    cp = CALLOC_STRUCT(ilo_cp);
    if (!cp)
        return NULL;

    cp->winsys = winsys;
    cp->render_ctx = intel_winsys_create_context(winsys);

    cp->ring = ILO_CP_RING_RENDER;
    cp->no_implicit_flush = false;

    cp->bo_size = 8192;

    if (!direct_map) {
        cp->sys = MALLOC(cp->bo_size * 4);
        if (!cp->sys) {
            FREE(cp);
            return NULL;
        }

        cp->ptr = cp->sys;
    }

    ilo_cp_realloc_bo(cp);
    if (!cp->bo) {
        FREE(cp->sys);
        FREE(cp);
        return NULL;
    }

    ilo_cp_clear_buffer(cp);

    return cp;
}