}
-#define _EGL_DECLARE_DD(dpy) \
- _EGLDisplay *disp = _eglLookupDisplay(dpy); \
- _EGLDriver *drv; \
- do { \
- drv = _eglCheckDisplay(disp, __FUNCTION__); \
- if (!drv) \
- return EGL_FALSE; \
- } while (0)
-
-
-#define _EGL_DECLARE_DD_AND_SURFACE(dpy, surface) \
- _EGLDisplay *disp = _eglLookupDisplay(dpy); \
- _EGLSurface *surf = _eglLookupSurface((surface), disp); \
- _EGLDriver *drv; \
- do { \
- drv = _eglCheckSurface(disp, surf, __FUNCTION__); \
- if (!drv) \
- return EGL_FALSE; \
- } while (0)
-
-
-#define _EGL_DECLARE_DD_AND_CONTEXT(dpy, ctx) \
- _EGLDisplay *disp = _eglLookupDisplay(dpy); \
- _EGLContext *context = _eglLookupContext((ctx), disp); \
- _EGLDriver *drv; \
- do { \
- drv = _eglCheckContext(disp, context, __FUNCTION__); \
- if (!drv) \
- return EGL_FALSE; \
- } while (0)
-
-
-#define _EGL_DECLARE_DD_AND_SCREEN(dpy, screen) \
- _EGLDisplay *disp = _eglLookupDisplay(dpy); \
- _EGLScreen *scrn = _eglLookupScreen((screen), disp); \
- _EGLDriver *drv; \
- do { \
- drv = _eglCheckScreen(disp, scrn, __FUNCTION__); \
- if (!drv) \
- return EGL_FALSE; \
- } while (0)
-
-
-#define _EGL_DECLARE_DD_AND_MODE(dpy, mode) \
- _EGLDisplay *disp = _eglLookupDisplay(dpy); \
- _EGLMode *m = _eglLookupMode((mode), disp); \
- _EGLDriver *drv; \
- do { \
- drv = _eglCheckMode(disp, m, __FUNCTION__); \
- if (!drv) \
- return EGL_FALSE; \
- } while (0)
-
-
const char * EGLAPIENTRY
eglQueryString(EGLDisplay dpy, EGLint name)
{
- _EGL_DECLARE_DD(dpy);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_DISPLAY(disp, NULL);
return drv->API.QueryString(drv, disp, name);
}
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
EGLint config_size, EGLint *num_config)
{
- _EGL_DECLARE_DD(dpy);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
return drv->API.GetConfigs(drv, disp, configs, config_size, num_config);
}
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs,
EGLint config_size, EGLint *num_config)
{
- _EGL_DECLARE_DD(dpy);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
return drv->API.ChooseConfig(drv, disp, attrib_list, configs,
config_size, num_config);
}
_EGLConfig *conf = _eglLookupConfig(config, disp);
_EGLDriver *drv;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_FALSE;
-
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE);
return drv->API.GetConfigAttrib(drv, disp, conf, attribute, value);
}
_EGLDriver *drv;
_EGLContext *context;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_CONTEXT;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT);
if (!share && share_list != EGL_NO_CONTEXT) {
_eglError(EGL_BAD_CONTEXT, __FUNCTION__);
return EGL_NO_CONTEXT;
EGLBoolean EGLAPIENTRY
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
- _EGL_DECLARE_DD_AND_CONTEXT(dpy, ctx);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLContext *context = _eglLookupContext(ctx, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
_eglUnlinkContext(context);
return drv->API.DestroyContext(drv, disp, context);
}
eglQueryContext(EGLDisplay dpy, EGLContext ctx,
EGLint attribute, EGLint *value)
{
- _EGL_DECLARE_DD_AND_CONTEXT(dpy, ctx);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLContext *context = _eglLookupContext(ctx, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
return drv->API.QueryContext(drv, disp, context, attribute, value);
}
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_SURFACE;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
if (surf)
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_SURFACE;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
if (surf)
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_SURFACE;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
if (surf)
EGLBoolean EGLAPIENTRY
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
_eglUnlinkSurface(surf);
return drv->API.DestroySurface(drv, disp, surf);
}
eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint *value)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
return drv->API.QuerySurface(drv, disp, surf, attribute, value);
}
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint value)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
return drv->API.SurfaceAttrib(drv, disp, surf, attribute, value);
}
EGLBoolean EGLAPIENTRY
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
return drv->API.BindTexImage(drv, disp, surf, buffer);
}
EGLBoolean EGLAPIENTRY
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
return drv->API.ReleaseTexImage(drv, disp, surf, buffer);
}
EGLBoolean EGLAPIENTRY
eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLContext *ctx = _eglGetCurrentContext();
_EGLSurface *surf;
- _EGL_DECLARE_DD(dpy);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp)
return _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
_EGLContext *ctx = _eglGetCurrentContext();
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
/* surface must be bound to current context in EGL 1.4 */
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
EGLBoolean EGLAPIENTRY
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
{
- _EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLSurface *surf = _eglLookupSurface(surface, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
return drv->API.CopyBuffers(drv, disp, surf, target);
}
const EGLint *attrib_list, EGLModeMESA *modes,
EGLint modes_size, EGLint *num_modes)
{
- _EGL_DECLARE_DD_AND_SCREEN(dpy, screen);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLScreen *scrn = _eglLookupScreen(screen, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
return drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list,
modes, modes_size, num_modes);
}
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes,
EGLint mode_size, EGLint *num_mode)
{
- _EGL_DECLARE_DD_AND_SCREEN(dpy, screen);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLScreen *scrn = _eglLookupScreen(screen, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
return drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode);
}
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,
EGLint attribute, EGLint *value)
{
- _EGL_DECLARE_DD_AND_MODE(dpy, mode);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLMode *m = _eglLookupMode(mode, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_MODE(disp, m, EGL_FALSE);
return drv->API.GetModeAttribMESA(drv, disp, m, attribute, value);
}
_EGLContext *dest_context = _eglLookupContext(dest, disp);
_EGLDriver *drv;
- drv = _eglCheckContext(disp, source_context, __FUNCTION__);
- if (!drv || !dest_context) {
- if (drv)
- _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
+ drv = _EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE);
+ if (!dest_context) {
+ _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
return EGL_FALSE;
}
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,
EGLint max_screens, EGLint *num_screens)
{
- _EGL_DECLARE_DD(dpy);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
return drv->API.GetScreensMESA(drv, disp, screens,
max_screens, num_screens);
}
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_SURFACE;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
if (surf)
_EGLMode *m = _eglLookupMode(mode, disp);
_EGLDriver *drv;
- drv = _eglCheckScreen(disp, scrn, __FUNCTION__);
- if (!drv)
- return EGL_FALSE;
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
if (!surf && surface != EGL_NO_SURFACE)
return _eglError(EGL_BAD_SURFACE, __FUNCTION__);
if (!m && mode != EGL_NO_MODE_MESA)
EGLBoolean
eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y)
{
- _EGL_DECLARE_DD_AND_SCREEN(dpy, screen);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLScreen *scrn = _eglLookupScreen(screen, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
return drv->API.ScreenPositionMESA(drv, disp, scrn, x, y);
}
eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,
EGLint attribute, EGLint *value)
{
- _EGL_DECLARE_DD_AND_SCREEN(dpy, screen);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLScreen *scrn = _eglLookupScreen(screen, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
return drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value);
}
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckScreen(disp, scrn, __FUNCTION__);
- if (!drv)
- return EGL_FALSE;
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
if (drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf) != EGL_TRUE)
surf = NULL;
_EGLDriver *drv;
_EGLMode *m;
- drv = _eglCheckScreen(disp, scrn, __FUNCTION__);
- if (!drv)
- return EGL_FALSE;
+ drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
if (drv->API.QueryScreenModeMESA(drv, disp, scrn, &m) != EGL_TRUE)
m = NULL;
const char *
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
{
- _EGL_DECLARE_DD_AND_MODE(dpy, mode);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLMode *m = _eglLookupMode(mode, disp);
+ _EGLDriver *drv;
+
+ drv = _EGL_CHECK_MODE(disp, m, NULL);
return drv->API.QueryModeStringMESA(drv, disp, m);
}
_EGLDriver *drv;
_EGLSurface *surf;
- drv = _eglCheckConfig(disp, conf, __FUNCTION__);
- if (!drv)
- return EGL_NO_SURFACE;
+ drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer,
conf, attrib_list);
_EGLDriver *drv;
_EGLImage *img;
- drv = _eglCheckDisplay(disp, __FUNCTION__);
- if (!drv)
- return EGL_NO_IMAGE_KHR;
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR);
if (!context && ctx != EGL_NO_CONTEXT) {
_eglError(EGL_BAD_CONTEXT, __FUNCTION__);
return EGL_NO_IMAGE_KHR;
_EGLImage *img = _eglLookupImage(image, disp);
_EGLDriver *drv;
- drv = _eglCheckDisplay(disp, __FUNCTION__);
- if (!drv)
- return EGL_FALSE;
+ drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
if (!img)
return _eglError(EGL_BAD_PARAMETER, __FUNCTION__);