return index;
}
+
/**
* Map a buffer index to an attachment.
*/
return statt;
}
+
/**
* Make sure a context picks up the latest cached state of the
* drawables it binds to.
}
}
+
/**
* Validate a framebuffer to make sure up-to-date pipe_textures are used.
* The context is only used for creating pipe surfaces and for calling
}
}
+
/**
* Update the attachments to validate by looping the existing renderbuffers.
*/
stfb->stamp++;
}
+
/**
* Add a renderbuffer to the framebuffer. The framebuffer is one that
* corresponds to a window and is not a user-created FBO.
return TRUE;
}
+
/**
* Intialize a struct gl_config from a visual.
*/
if (st_visual_have_buffers(visual, ST_ATTACHMENT_BACK_LEFT_MASK))
mode->doubleBufferMode = GL_TRUE;
+
if (st_visual_have_buffers(visual,
ST_ATTACHMENT_FRONT_RIGHT_MASK | ST_ATTACHMENT_BACK_RIGHT_MASK))
mode->stereoMode = GL_TRUE;
}
}
+
/**
* Create a framebuffer from a manager interface.
*/
return stfb;
}
+
/**
* Reference a framebuffer.
*/
}
}
+
static void
st_context_flush(struct st_context_iface *stctxi, unsigned flags,
struct pipe_fence_handle **fence)
return TRUE;
}
+
static void
st_context_copy(struct st_context_iface *stctxi,
struct st_context_iface *stsrci, unsigned mask)
_mesa_copy_context(src->ctx, st->ctx, mask);
}
+
static boolean
st_context_share(struct st_context_iface *stctxi,
struct st_context_iface *stsrci)
return _mesa_share_state(st->ctx, src->ctx);
}
+
static void
st_context_destroy(struct st_context_iface *stctxi)
{
st_destroy_context(st);
}
+
static void
st_start_thread(struct st_context_iface *stctxi)
{
_mesa_glthread_init(st->ctx);
}
+
static void
st_thread_finish(struct st_context_iface *stctxi)
{
}
st_visual_to_context_mode(&attribs->visual, &mode);
- st = st_create_context(api, pipe, &mode, shared_ctx, &attribs->options, no_error);
+ st = st_create_context(api, pipe, &mode, shared_ctx,
+ &attribs->options, no_error);
if (!st) {
*error = ST_CONTEXT_ERROR_NO_MEMORY;
pipe->destroy(pipe);
return &st->iface;
}
+
static struct st_context_iface *
st_api_get_current(struct st_api *stapi)
{
GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = (ctx) ? ctx->st : NULL;
+ struct st_context *st = ctx ? ctx->st : NULL;
- return (st) ? &st->iface : NULL;
+ return st ? &st->iface : NULL;
}
+
static struct st_framebuffer *
st_framebuffer_reuse_or_create(struct st_context *st,
struct gl_framebuffer *fb,
struct st_framebuffer *cur = NULL, *stfb = NULL;
if (!stfbi)
- return NULL;
+ return NULL;
/* Check if there is already a framebuffer object for the specified
* framebuffer interface in this context. If there is one, use it.
return stfb;
}
+
static boolean
st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
struct st_framebuffer_iface *stdrawi,
return ret;
}
+
static void
st_api_destroy(struct st_api *stapi)
{
}
+
/**
* Flush the front buffer if the current context renders to the front buffer.
*/
struct st_renderbuffer *strb = NULL;
if (stfb)
- strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].
+ Renderbuffer);
/* Do we have a front color buffer and has it been drawn to since last
* frontbuffer flush?
}
}
+
/**
* Re-validate the framebuffers.
*/
return _mesa_get_version(&extensions, &consts, api);
}
+
static void
st_api_query_versions(struct st_api *stapi, struct st_manager *sm,
struct st_config_options *options,
*gl_es2_version = get_version(sm->screen, options, API_OPENGLES2);
}
+
static const struct st_api st_gl_api = {
.name = "Mesa " PACKAGE_VERSION,
.api = ST_API_OPENGL,
.destroy_drawable = st_api_destroy_drawable,
};
+
struct st_api *
st_gl_api_create(void)
{