#include <stdio.h>
#include <string.h>
-/**#include "glapi.h"**/
#include "eglcontext.h"
#include "egldisplay.h"
#include "egltypedefs.h"
if (dpy) {
_EGLDriver *drv = _eglChooseDriver(dpy);
if (drv)
- return drv->Initialize(drv, dpy, major, minor);
+ return drv->API.Initialize(drv, dpy, major, minor);
}
return EGL_FALSE;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->QueryString(drv, dpy, name);
+ return drv->API.QueryString(drv, dpy, name);
else
return NULL;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
/* XXX check drv for null in remaining functions */
- return drv->GetConfigs(drv, dpy, configs, config_size, num_config);
+ return drv->API.GetConfigs(drv, dpy, configs, config_size, num_config);
}
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config);
+ return drv->API.ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config);
}
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->GetConfigAttrib(drv, dpy, config, attribute, value);
+ return drv->API.GetConfigAttrib(drv, dpy, config, attribute, value);
}
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CreateContext(drv, dpy, config, share_list, attrib_list);
+ return drv->API.CreateContext(drv, dpy, config, share_list, attrib_list);
}
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->DestroyContext(drv, dpy, ctx);
+ return drv->API.DestroyContext(drv, dpy, ctx);
}
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->MakeCurrent(drv, dpy, draw, read, ctx);
+ return drv->API.MakeCurrent(drv, dpy, draw, read, ctx);
}
eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QueryContext(drv, dpy, ctx, attribute, value);
+ return drv->API.QueryContext(drv, dpy, ctx, attribute, value);
}
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CreateWindowSurface(drv, dpy, config, window, attrib_list);
+ return drv->API.CreateWindowSurface(drv, dpy, config, window, attrib_list);
}
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list);
+ return drv->API.CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list);
}
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CreatePbufferSurface(drv, dpy, config, attrib_list);
+ return drv->API.CreatePbufferSurface(drv, dpy, config, attrib_list);
}
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->DestroySurface(drv, dpy, surface);
+ return drv->API.DestroySurface(drv, dpy, surface);
}
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QuerySurface(drv, dpy, surface, attribute, value);
+ return drv->API.QuerySurface(drv, dpy, surface, attribute, value);
}
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->SurfaceAttrib(drv, dpy, surface, attribute, value);
+ return drv->API.SurfaceAttrib(drv, dpy, surface, attribute, value);
}
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->BindTexImage(drv, dpy, surface, buffer);
+ return drv->API.BindTexImage(drv, dpy, surface, buffer);
}
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->ReleaseTexImage(drv, dpy, surface, buffer);
+ return drv->API.ReleaseTexImage(drv, dpy, surface, buffer);
}
eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->SwapInterval(drv, dpy, interval);
+ return drv->API.SwapInterval(drv, dpy, interval);
}
eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->SwapBuffers(drv, dpy, draw);
+ return drv->API.SwapBuffers(drv, dpy, draw);
}
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CopyBuffers(drv, dpy, surface, target);
+ return drv->API.CopyBuffers(drv, dpy, surface, target);
}
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy != EGL_NO_DISPLAY) {
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->WaitGL(drv, dpy);
+ return drv->API.WaitGL(drv, dpy);
}
else
return EGL_FALSE;
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy != EGL_NO_DISPLAY) {
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->WaitNative(drv, dpy, engine);
+ return drv->API.WaitNative(drv, dpy, engine);
}
else
return EGL_FALSE;
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes);
+ return drv->API.ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes);
else
return EGL_FALSE;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode);
+ return drv->API.GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode);
else
return EGL_FALSE;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->GetModeAttribMESA(drv, dpy, mode, attribute, value);
+ return drv->API.GetModeAttribMESA(drv, dpy, mode, attribute, value);
else
return EGL_FALSE;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->CopyContextMESA(drv, dpy, source, dest, mask);
+ return drv->API.CopyContextMESA(drv, dpy, source, dest, mask);
else
return EGL_FALSE;
}
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
- return drv->GetScreensMESA(drv, dpy, screens, max_screens, num_screens);
+ return drv->API.GetScreensMESA(drv, dpy, screens, max_screens, num_screens);
else
return EGL_FALSE;
}
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->CreateScreenSurfaceMESA(drv, dpy, config, attrib_list);
+ return drv->API.CreateScreenSurfaceMESA(drv, dpy, config, attrib_list);
}
eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->ShowSurfaceMESA(drv, dpy, screen, surface, mode);
+ return drv->API.ShowSurfaceMESA(drv, dpy, screen, surface, mode);
}
eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->ScreenPositionMESA(drv, dpy, screen, x, y);
+ return drv->API.ScreenPositionMESA(drv, dpy, screen, x, y);
}
eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QueryScreenMESA(drv, dpy, screen, attribute, value);
+ return drv->API.QueryScreenMESA(drv, dpy, screen, attribute, value);
}
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QueryScreenSurfaceMESA(drv, dpy, screen, surface);
+ return drv->API.QueryScreenSurfaceMESA(drv, dpy, screen, surface);
}
eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QueryScreenModeMESA(drv, dpy, screen, mode);
+ return drv->API.QueryScreenModeMESA(drv, dpy, screen, mode);
}
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->QueryModeStringMESA(drv, dpy, mode);
+ return drv->API.QueryModeStringMESA(drv, dpy, mode);
}
--- /dev/null
+#ifndef EGLAPI_INCLUDED
+#define EGLAPI_INCLUDED
+
+/**
+ * Typedefs for all EGL API entrypoint functions.
+ */
+
+
+/* driver funcs */
+typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
+typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
+
+/* config funcs */
+typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+
+/* context funcs */
+typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
+typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
+typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+
+/* surface funcs */
+typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
+typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
+typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
+typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
+typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
+typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
+
+/* misc funcs */
+typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
+typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
+typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
+
+
+/* EGL_MESA_screen extension */
+typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
+typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
+typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
+typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
+typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+typedef EGLBoolean (*ShowSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
+typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
+typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
+typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
+typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
+typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
+
+
+/**
+ * The API dispatcher jumps through these functions
+ */
+struct _egl_api
+{
+ Initialize_t Initialize;
+ Terminate_t Terminate;
+
+ GetConfigs_t GetConfigs;
+ ChooseConfig_t ChooseConfig;
+ GetConfigAttrib_t GetConfigAttrib;
+
+ CreateContext_t CreateContext;
+ DestroyContext_t DestroyContext;
+ MakeCurrent_t MakeCurrent;
+ QueryContext_t QueryContext;
+
+ CreateWindowSurface_t CreateWindowSurface;
+ CreatePixmapSurface_t CreatePixmapSurface;
+ CreatePbufferSurface_t CreatePbufferSurface;
+ DestroySurface_t DestroySurface;
+ QuerySurface_t QuerySurface;
+ SurfaceAttrib_t SurfaceAttrib;
+ BindTexImage_t BindTexImage;
+ ReleaseTexImage_t ReleaseTexImage;
+ SwapInterval_t SwapInterval;
+ SwapBuffers_t SwapBuffers;
+ CopyBuffers_t CopyBuffers;
+
+ QueryString_t QueryString;
+ WaitGL_t WaitGL;
+ WaitNative_t WaitNative;
+
+ /* EGL_MESA_screen extension */
+ ChooseModeMESA_t ChooseModeMESA;
+ GetModesMESA_t GetModesMESA;
+ GetModeAttribMESA_t GetModeAttribMESA;
+ CopyContextMESA_t CopyContextMESA;
+ GetScreensMESA_t GetScreensMESA;
+ CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
+ ShowSurfaceMESA_t ShowSurfaceMESA;
+ ScreenPositionMESA_t ScreenPositionMESA;
+ QueryScreenMESA_t QueryScreenMESA;
+ QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
+ QueryScreenModeMESA_t QueryScreenModeMESA;
+ QueryModeStringMESA_t QueryModeStringMESA;
+};
+
+#endif /* EGLAPI_INCLUDED */
draw = NULL;
}
/* really delete surface now */
- drv->DestroySurface(drv, dpy, oldDrawSurface->Handle);
+ drv->API.DestroySurface(drv, dpy, oldDrawSurface->Handle);
}
}
if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) {
read = NULL;
}
/* really delete surface now */
- drv->DestroySurface(drv, dpy, oldReadSurface->Handle);
+ drv->API.DestroySurface(drv, dpy, oldReadSurface->Handle);
}
}
if (oldContext != NULL) {
ctx = NULL;
}
/* really delete context now */
- drv->DestroyContext(drv, dpy, oldContext->Handle);
+ drv->API.DestroyContext(drv, dpy, oldContext->Handle);
}
}
* XXX check for currently bound context/surfaces and delete them?
*/
- b = drv->Terminate(drv, dpy);
+ b = drv->API.Terminate(drv, dpy);
dlclose(handle);
return b;
}
/* If a pointer is set to NULL, then the device driver _really_ has
* to implement it.
*/
- drv->Initialize = NULL;
- drv->Terminate = NULL;
-
- drv->GetConfigs = _eglGetConfigs;
- drv->ChooseConfig = _eglChooseConfig;
- drv->GetConfigAttrib = _eglGetConfigAttrib;
-
- drv->CreateContext = _eglCreateContext;
- drv->DestroyContext = _eglDestroyContext;
- drv->MakeCurrent = _eglMakeCurrent;
- drv->QueryContext = _eglQueryContext;
-
- drv->CreateWindowSurface = _eglCreateWindowSurface;
- drv->CreatePixmapSurface = _eglCreatePixmapSurface;
- drv->CreatePbufferSurface = _eglCreatePbufferSurface;
- drv->DestroySurface = _eglDestroySurface;
- drv->QuerySurface = _eglQuerySurface;
- drv->SurfaceAttrib = _eglSurfaceAttrib;
- drv->BindTexImage = _eglBindTexImage;
- drv->ReleaseTexImage = _eglReleaseTexImage;
- drv->SwapInterval = _eglSwapInterval;
- drv->SwapBuffers = _eglSwapBuffers;
- drv->CopyBuffers = _eglCopyBuffers;
-
- drv->QueryString = _eglQueryString;
- drv->WaitGL = _eglWaitGL;
- drv->WaitNative = _eglWaitNative;
+ drv->API.Initialize = NULL;
+ drv->API.Terminate = NULL;
+
+ drv->API.GetConfigs = _eglGetConfigs;
+ drv->API.ChooseConfig = _eglChooseConfig;
+ drv->API.GetConfigAttrib = _eglGetConfigAttrib;
+
+ drv->API.CreateContext = _eglCreateContext;
+ drv->API.DestroyContext = _eglDestroyContext;
+ drv->API.MakeCurrent = _eglMakeCurrent;
+ drv->API.QueryContext = _eglQueryContext;
+
+ drv->API.CreateWindowSurface = _eglCreateWindowSurface;
+ drv->API.CreatePixmapSurface = _eglCreatePixmapSurface;
+ drv->API.CreatePbufferSurface = _eglCreatePbufferSurface;
+ drv->API.DestroySurface = _eglDestroySurface;
+ drv->API.QuerySurface = _eglQuerySurface;
+ drv->API.SurfaceAttrib = _eglSurfaceAttrib;
+ drv->API.BindTexImage = _eglBindTexImage;
+ drv->API.ReleaseTexImage = _eglReleaseTexImage;
+ drv->API.SwapInterval = _eglSwapInterval;
+ drv->API.SwapBuffers = _eglSwapBuffers;
+ drv->API.CopyBuffers = _eglCopyBuffers;
+
+ drv->API.QueryString = _eglQueryString;
+ drv->API.WaitGL = _eglWaitGL;
+ drv->API.WaitNative = _eglWaitNative;
/* EGL_MESA_screen */
- drv->ChooseModeMESA = _eglChooseModeMESA;
- drv->GetModesMESA = _eglGetModesMESA;
- drv->GetModeAttribMESA = _eglGetModeAttribMESA;
- drv->GetScreensMESA = _eglGetScreensMESA;
- drv->CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
- drv->ShowSurfaceMESA = _eglShowSurfaceMESA;
- drv->ScreenPositionMESA = _eglScreenPositionMESA;
- drv->QueryScreenMESA = _eglQueryScreenMESA;
- drv->QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
- drv->QueryScreenModeMESA = _eglQueryScreenModeMESA;
- drv->QueryModeStringMESA = _eglQueryModeStringMESA;
+ drv->API.ChooseModeMESA = _eglChooseModeMESA;
+ drv->API.GetModesMESA = _eglGetModesMESA;
+ drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
+ drv->API.GetScreensMESA = _eglGetScreensMESA;
+ drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
+ drv->API.ShowSurfaceMESA = _eglShowSurfaceMESA;
+ drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
+ drv->API.QueryScreenMESA = _eglQueryScreenMESA;
+ drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
+ drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
+ drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
}
#include "egltypedefs.h"
+#include "eglapi.h"
/* should probably use a dynamic-lengh string, but this will do */
#define MAX_EXTENSIONS_LEN 1000
-/* driver funcs */
-typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
-typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
-
-/* config funcs */
-typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-
-/* context funcs */
-typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
-typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-
-/* surface funcs */
-typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
-typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
-typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
-typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
-
-/* misc funcs */
-typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
-typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
-typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
-
-
-/* EGL_MESA_screen extension */
-typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
-typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (*ShowSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
-typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
-
-
/**
* Base class for device drivers.
*/
int ABIversion;
int APImajor, APIminor; /* returned through eglInitialize */
- /*
- * The API dispatcher jumps through these functions
- */
- Initialize_t Initialize;
- Terminate_t Terminate;
-
- GetConfigs_t GetConfigs;
- ChooseConfig_t ChooseConfig;
- GetConfigAttrib_t GetConfigAttrib;
-
- CreateContext_t CreateContext;
- DestroyContext_t DestroyContext;
- MakeCurrent_t MakeCurrent;
- QueryContext_t QueryContext;
-
- CreateWindowSurface_t CreateWindowSurface;
- CreatePixmapSurface_t CreatePixmapSurface;
- CreatePbufferSurface_t CreatePbufferSurface;
- DestroySurface_t DestroySurface;
- QuerySurface_t QuerySurface;
- SurfaceAttrib_t SurfaceAttrib;
- BindTexImage_t BindTexImage;
- ReleaseTexImage_t ReleaseTexImage;
- SwapInterval_t SwapInterval;
- SwapBuffers_t SwapBuffers;
- CopyBuffers_t CopyBuffers;
-
- QueryString_t QueryString;
- WaitGL_t WaitGL;
- WaitNative_t WaitNative;
-
- /* EGL_MESA_screen extension */
- ChooseModeMESA_t ChooseModeMESA;
- GetModesMESA_t GetModesMESA;
- GetModeAttribMESA_t GetModeAttribMESA;
- CopyContextMESA_t CopyContextMESA;
- GetScreensMESA_t GetScreensMESA;
- CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
- ShowSurfaceMESA_t ShowSurfaceMESA;
- ScreenPositionMESA_t ScreenPositionMESA;
- QueryScreenMESA_t QueryScreenMESA;
- QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
- QueryScreenModeMESA_t QueryScreenModeMESA;
- QueryModeStringMESA_t QueryModeStringMESA;
+ _EGLAPI API;
/* Extension enable flags */
EGLBoolean MESA_screen_surface;
#include <GLES/egl.h>
+typedef struct _egl_api _EGLAPI;
+
typedef struct _egl_config _EGLConfig;
typedef struct _egl_context _EGLContext;