#ifndef EGLCONTEXT_INCLUDED
#define EGLCONTEXT_INCLUDED
#include "egltypedefs.h"
#include "egldisplay.h"
struct _egl_context
{
_EGLResource Resource;
_EGLThreadInfo *Binding;
_EGLSurface *DrawSurface;
_EGLSurface *ReadSurface;
_EGLConfig *Config;
EGLint ClientAPI;
EGLint ClientVersion;
EGLint WindowRenderBuffer;
};
PUBLIC EGLBoolean
_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *config, const EGLint *attrib_list);
extern _EGLContext *
_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
extern EGLBoolean
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
PUBLIC EGLBoolean
_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read);
extern EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
extern EGLBoolean
_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
static INLINE EGLBoolean
_eglIsContextBound(_EGLContext *ctx)
{
return (ctx->Binding != NULL);
}
static INLINE EGLContext
_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
{
_eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT, dpy);
return (EGLContext) ctx;
}
static INLINE void
_eglUnlinkContext(_EGLContext *ctx)
{
_eglUnlinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT);
}
static INLINE _EGLContext *
_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
{
_EGLContext *ctx = (_EGLContext *) context;
if (!dpy || !_eglCheckResource((void *) ctx, _EGL_RESOURCE_CONTEXT, dpy))
ctx = NULL;
return ctx;
}
static INLINE EGLContext
_eglGetContextHandle(_EGLContext *ctx)
{
_EGLResource *res = (_EGLResource *) ctx;
return (res && _eglIsResourceLinked(res)) ?
(EGLContext) ctx : EGL_NO_CONTEXT;
}
static INLINE EGLBoolean
_eglIsContextLinked(_EGLContext *ctx)
{
_EGLResource *res = (_EGLResource *) ctx;
return (res && _eglIsResourceLinked(res));
}
#endif