* Chia-I Wu <olv@lunarg.com>
*/
-#include "state_tracker/st_api.h"
+#include "state_tracker/st_gl_api.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
_mesa_clear_texture_image(ctx, texImage);
}
- stObj->pipe = st->pipe;
pipe_resource_reference(&stImage->pt, tex);
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
static void
st_api_destroy(struct st_api *stapi)
{
- FREE(stapi);
}
/**
if (!strb)
return;
- /* st_public.h */
- if (!stfb->iface) {
- struct pipe_surface *front_surf = strb->surface;
- st->pipe->screen->flush_frontbuffer(st->pipe->screen,
- front_surf, st->winsys_drawable_handle);
- return;
- }
-
stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
}
struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer);
- /* st_public.h */
- if ((stdraw && !stdraw->iface) || (stread && !stread->iface)) {
- struct pipe_screen *screen = st->pipe->screen;
- if (screen->update_buffer)
- screen->update_buffer(screen, st->pipe->priv);
- return;
- }
-
if (stdraw)
st_framebuffer_validate(stdraw, st);
if (stread && stread != stdraw)
{
struct st_framebuffer *stfb = st_ws_framebuffer(fb);
- /* FBO or st_public.h */
- if (!stfb || !stfb->iface)
+ /* FBO */
+ if (!stfb)
return FALSE;
if (stfb->Base.Attachment[idx].Renderbuffer)
return TRUE;
}
+struct st_api st_gl_api = {
+ st_api_destroy,
+ st_api_get_proc_address,
+ st_api_is_visual_supported,
+ st_api_create_context,
+ st_api_make_current,
+ st_api_get_current,
+};
+
/**
- * Create an st_api to manage the state tracker.
+ * Return the st_api for this state tracker. This might either be GL, GLES1,
+ * GLES2 that mostly depends on the build and link options. But these
+ * functions remain the same either way.
*/
struct st_api *
-st_manager_create_api(void)
+st_gl_api_create(void)
{
- struct st_api *stapi;
-
- stapi = CALLOC_STRUCT(st_api);
- if (stapi) {
- stapi->destroy = st_api_destroy;
- stapi->get_proc_address = st_api_get_proc_address;
- stapi->is_visual_supported = st_api_is_visual_supported;
-
- stapi->create_context = st_api_create_context;
- stapi->make_current = st_api_make_current;
- stapi->get_current = st_api_get_current;
- }
-
- return stapi;
+ return &st_gl_api;
}