diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/main/eglapi.c | 69 | ||||
-rw-r--r-- | src/egl/main/eglapi.h | 106 | ||||
-rw-r--r-- | src/egl/main/eglcontext.c | 6 | ||||
-rw-r--r-- | src/egl/main/egldriver.c | 78 | ||||
-rw-r--r-- | src/egl/main/egldriver.h | 95 | ||||
-rw-r--r-- | src/egl/main/egltypedefs.h | 2 |
6 files changed, 186 insertions, 170 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 87160c7f48..a31b252311 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -32,7 +32,6 @@ #include <stdio.h> #include <string.h> -/**#include "glapi.h"**/ #include "eglcontext.h" #include "egldisplay.h" #include "egltypedefs.h" @@ -66,7 +65,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) 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; } @@ -88,7 +87,7 @@ eglQueryString(EGLDisplay dpy, EGLint name) { _EGLDriver *drv = _eglLookupDriver(dpy); if (drv) - return drv->QueryString(drv, dpy, name); + return drv->API.QueryString(drv, dpy, name); else return NULL; } @@ -99,7 +98,7 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *nu { _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); } @@ -107,7 +106,7 @@ EGLBoolean APIENTRY 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); } @@ -115,7 +114,7 @@ EGLBoolean APIENTRY 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); } @@ -123,7 +122,7 @@ EGLContext APIENTRY 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); } @@ -131,7 +130,7 @@ EGLBoolean APIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->DestroyContext(drv, dpy, ctx); + return drv->API.DestroyContext(drv, dpy, ctx); } @@ -139,7 +138,7 @@ EGLBoolean APIENTRY 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); } @@ -147,7 +146,7 @@ EGLBoolean APIENTRY 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); } @@ -155,7 +154,7 @@ EGLSurface APIENTRY 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); } @@ -163,7 +162,7 @@ EGLSurface APIENTRY 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); } @@ -171,7 +170,7 @@ EGLSurface APIENTRY 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); } @@ -179,7 +178,7 @@ EGLBoolean APIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->DestroySurface(drv, dpy, surface); + return drv->API.DestroySurface(drv, dpy, surface); } @@ -187,7 +186,7 @@ EGLBoolean APIENTRY 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); } @@ -195,7 +194,7 @@ EGLBoolean APIENTRY 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); } @@ -203,7 +202,7 @@ EGLBoolean APIENTRY 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); } @@ -211,7 +210,7 @@ EGLBoolean APIENTRY 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); } @@ -219,7 +218,7 @@ EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->SwapInterval(drv, dpy, interval); + return drv->API.SwapInterval(drv, dpy, interval); } @@ -227,7 +226,7 @@ EGLBoolean APIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) { _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->SwapBuffers(drv, dpy, draw); + return drv->API.SwapBuffers(drv, dpy, draw); } @@ -235,7 +234,7 @@ EGLBoolean APIENTRY 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); } @@ -245,7 +244,7 @@ eglWaitGL(void) 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; @@ -258,7 +257,7 @@ eglWaitNative(EGLint engine) 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; @@ -386,7 +385,7 @@ eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, { _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; } @@ -397,7 +396,7 @@ eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint { _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; } @@ -408,7 +407,7 @@ eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint { _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; } @@ -419,7 +418,7 @@ eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint ma { _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; } @@ -430,7 +429,7 @@ eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EG { _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; } @@ -440,7 +439,7 @@ EGLSurface 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); } @@ -448,7 +447,7 @@ EGLBoolean 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); } @@ -456,7 +455,7 @@ EGLBoolean 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); } @@ -464,7 +463,7 @@ EGLBoolean 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); } @@ -472,7 +471,7 @@ EGLBoolean 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); } @@ -480,7 +479,7 @@ EGLBoolean 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); } @@ -488,7 +487,7 @@ const char * eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) { _EGLDriver *drv = _eglLookupDriver(dpy); - return drv->QueryModeStringMESA(drv, dpy, mode); + return drv->API.QueryModeStringMESA(drv, dpy, mode); } diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h new file mode 100644 index 0000000000..dad653af97 --- /dev/null +++ b/src/egl/main/eglapi.h @@ -0,0 +1,106 @@ +#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 */ diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 283dd3f1a5..42edd1f77e 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -181,7 +181,7 @@ _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, EGLSurface r, EGL draw = NULL; } /* really delete surface now */ - drv->DestroySurface(drv, dpy, oldDrawSurface->Handle); + drv->API.DestroySurface(drv, dpy, oldDrawSurface->Handle); } } if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) { @@ -192,7 +192,7 @@ _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, EGLSurface r, EGL read = NULL; } /* really delete surface now */ - drv->DestroySurface(drv, dpy, oldReadSurface->Handle); + drv->API.DestroySurface(drv, dpy, oldReadSurface->Handle); } } if (oldContext != NULL) { @@ -203,7 +203,7 @@ _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, EGLSurface r, EGL ctx = NULL; } /* really delete context now */ - drv->DestroyContext(drv, dpy, oldContext->Handle); + drv->API.DestroyContext(drv, dpy, oldContext->Handle); } } diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 4602f86e82..e2cc0692bc 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -123,7 +123,7 @@ _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy) * 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; } @@ -153,46 +153,46 @@ _eglInitDriverFallbacks(_EGLDriver *drv) /* 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; } diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h index 7ab62f1827..6d2d7075cd 100644 --- a/src/egl/main/egldriver.h +++ b/src/egl/main/egldriver.h @@ -3,60 +3,12 @@ #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. */ @@ -71,50 +23,7 @@ struct _egl_driver 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; diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h index a66fbed737..0a5ab7ad89 100644 --- a/src/egl/main/egltypedefs.h +++ b/src/egl/main/egltypedefs.h @@ -5,6 +5,8 @@ #include <GLES/egl.h> +typedef struct _egl_api _EGLAPI; + typedef struct _egl_config _EGLConfig; typedef struct _egl_context _EGLContext; |