Example #1
0
struct vg_context * st_create_context(struct pipe_context *pipe,
                                      const void *visual,
                                      struct vg_context *share)
{
   struct vg_context *ctx = vg_create_context(pipe, visual, share);
   /*debug_printf("--------- CREATE CONTEXT %p\n", ctx);*/
   return ctx;
}
Example #2
0
static struct st_context_iface *
vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
                      const struct st_context_attribs *attribs,
                      enum st_context_error *error,
                      struct st_context_iface *shared_stctxi)
{
    struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi;
    struct vg_context *ctx;
    struct pipe_context *pipe;

    if (!(stapi->profile_mask & (1 << attribs->profile))) {
        *error = ST_CONTEXT_ERROR_BAD_API;
        return NULL;
    }

    /* only 1.0 is supported */
    if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0)) {
        *error = ST_CONTEXT_ERROR_BAD_VERSION;
        return NULL;
    }

    /* for VGHandle / pointer lookups */
    init_handles();

    pipe = smapi->screen->context_create(smapi->screen, NULL);
    if (!pipe) {
        *error = ST_CONTEXT_ERROR_NO_MEMORY;
        return NULL;
    }
    ctx = vg_create_context(pipe, NULL, shared_ctx);
    if (!ctx) {
        pipe->destroy(pipe);
        *error = ST_CONTEXT_ERROR_NO_MEMORY;
        return NULL;
    }

    ctx->iface.destroy = vg_context_destroy;

    ctx->iface.flush = vg_context_flush;

    ctx->iface.teximage = NULL;
    ctx->iface.copy = NULL;

    ctx->iface.st_context_private = (void *) smapi;

    return &ctx->iface;
}
Example #3
0
static struct st_context_iface *
vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
                      const struct st_context_attribs *attribs,
                      struct st_context_iface *shared_stctxi)
{
   struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi;
   struct vg_context *ctx;
   struct pipe_context *pipe;

   if (!(stapi->profile_mask & (1 << attribs->profile)))
      return NULL;

   /* only 1.0 is supported */
   if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0))
      return NULL;

   pipe = smapi->screen->context_create(smapi->screen, NULL);
   if (!pipe)
      return NULL;
   ctx = vg_create_context(pipe, NULL, shared_ctx);
   if (!ctx) {
      pipe->destroy(pipe);
      return NULL;
   }

   ctx->iface.destroy = vg_context_destroy;

   ctx->iface.notify_invalid_framebuffer =
      vg_context_notify_invalid_framebuffer;
   ctx->iface.flush = vg_context_flush;

   ctx->iface.teximage = NULL;
   ctx->iface.copy = NULL;

   ctx->iface.st_context_private = (void *) smapi;

   return &ctx->iface;
}