michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GLLIBRARYEGL_H_ michael@0: #define GLLIBRARYEGL_H_ michael@0: michael@0: #if defined(MOZ_X11) michael@0: #include "mozilla/X11Util.h" michael@0: #endif michael@0: michael@0: #include "GLLibraryLoader.h" michael@0: michael@0: #include "nsIFile.h" michael@0: michael@0: #include michael@0: michael@0: #if defined(XP_WIN) michael@0: michael@0: #ifndef WIN32_LEAN_AND_MEAN michael@0: #define WIN32_LEAN_AND_MEAN 1 michael@0: #endif michael@0: michael@0: #include michael@0: michael@0: typedef HDC EGLNativeDisplayType; michael@0: typedef HBITMAP EGLNativePixmapType; michael@0: typedef HWND EGLNativeWindowType; michael@0: michael@0: #define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW)) michael@0: michael@0: #else michael@0: typedef void *EGLNativeDisplayType; michael@0: typedef void *EGLNativePixmapType; michael@0: typedef void *EGLNativeWindowType; michael@0: michael@0: #ifdef ANDROID michael@0: // We only need to explicitly dlopen egltrace michael@0: // on android as we can use LD_PRELOAD or other tricks michael@0: // on other platforms. We look for it in /data/local michael@0: // as that's writeable by all users michael@0: // michael@0: // This should really go in GLLibraryEGL.cpp but we currently reference michael@0: // APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring michael@0: // will come in subsequent patches on Bug 732865 michael@0: #define APITRACE_LIB "/data/local/tmp/egltrace.so" michael@0: michael@0: #ifdef MOZ_WIDGET_ANDROID michael@0: michael@0: #endif // MOZ_WIDGET_ANDROID michael@0: #endif // ANDROID michael@0: #endif michael@0: michael@0: #if defined(MOZ_X11) michael@0: #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)mozilla::DefaultXDisplay()) michael@0: #else michael@0: #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) michael@0: #endif michael@0: michael@0: namespace mozilla { michael@0: namespace gl { michael@0: michael@0: #undef BEFORE_GL_CALL michael@0: #undef AFTER_GL_CALL michael@0: michael@0: #ifdef DEBUG michael@0: michael@0: #ifndef MOZ_FUNCTION_NAME michael@0: # ifdef __GNUC__ michael@0: # define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__ michael@0: # elif defined(_MSC_VER) michael@0: # define MOZ_FUNCTION_NAME __FUNCTION__ michael@0: # else michael@0: # define MOZ_FUNCTION_NAME __func__ // defined in C99, supported in various C++ compilers. Just raw function name. michael@0: # endif michael@0: #endif michael@0: michael@0: #define BEFORE_GL_CALL do { \ michael@0: BeforeGLCall(MOZ_FUNCTION_NAME); \ michael@0: } while (0) michael@0: michael@0: #define AFTER_GL_CALL do { \ michael@0: AfterGLCall(MOZ_FUNCTION_NAME); \ michael@0: } while (0) michael@0: // We rely on the fact that GLLibraryEGL.h #defines BEFORE_GL_CALL and michael@0: // AFTER_GL_CALL to nothing if !defined(DEBUG). michael@0: #else michael@0: #define BEFORE_GL_CALL michael@0: #define AFTER_GL_CALL michael@0: #endif michael@0: michael@0: class GLLibraryEGL michael@0: { michael@0: public: michael@0: GLLibraryEGL() michael@0: : mInitialized(false), michael@0: mEGLLibrary(nullptr), michael@0: mIsANGLE(false) michael@0: { michael@0: } michael@0: michael@0: void InitExtensions(); michael@0: michael@0: /** michael@0: * Known GL extensions that can be queried by michael@0: * IsExtensionSupported. The results of this are cached, and as michael@0: * such it's safe to use this even in performance critical code. michael@0: * If you add to this array, remember to add to the string names michael@0: * in GLContext.cpp. michael@0: */ michael@0: enum EGLExtensions { michael@0: KHR_image_base, michael@0: KHR_image_pixmap, michael@0: KHR_gl_texture_2D_image, michael@0: KHR_lock_surface, michael@0: ANGLE_surface_d3d_texture_2d_share_handle, michael@0: EXT_create_context_robustness, michael@0: KHR_image, michael@0: KHR_fence_sync, michael@0: Extensions_Max michael@0: }; michael@0: michael@0: bool IsExtensionSupported(EGLExtensions aKnownExtension) const { michael@0: return mAvailableExtensions[aKnownExtension]; michael@0: } michael@0: michael@0: void MarkExtensionUnsupported(EGLExtensions aKnownExtension) { michael@0: mAvailableExtensions[aKnownExtension] = false; michael@0: } michael@0: michael@0: protected: michael@0: std::bitset mAvailableExtensions; michael@0: michael@0: public: michael@0: michael@0: EGLDisplay fGetDisplay(void* display_id) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLDisplay disp = mSymbols.fGetDisplay(display_id); michael@0: AFTER_GL_CALL; michael@0: return disp; michael@0: } michael@0: michael@0: EGLSurface fGetCurrentSurface(EGLint id) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLSurface surf = mSymbols.fGetCurrentSurface(id); michael@0: AFTER_GL_CALL; michael@0: return surf; michael@0: } michael@0: michael@0: EGLContext fGetCurrentContext() michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLContext context = mSymbols.fGetCurrentContext(); michael@0: AFTER_GL_CALL; michael@0: return context; michael@0: } michael@0: michael@0: EGLBoolean fMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fMakeCurrent(dpy, draw, read, ctx); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fDestroyContext(EGLDisplay dpy, EGLContext ctx) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fDestroyContext(dpy, ctx); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLContext fCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLContext ctx = mSymbols.fCreateContext(dpy, config, share_context, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return ctx; michael@0: } michael@0: michael@0: EGLBoolean fDestroySurface(EGLDisplay dpy, EGLSurface surface) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fDestroySurface(dpy, surface); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLSurface fCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLSurface surf = mSymbols.fCreateWindowSurface(dpy, config, win, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return surf; michael@0: } michael@0: michael@0: EGLSurface fCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLSurface surf = mSymbols.fCreatePbufferSurface(dpy, config, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return surf; michael@0: } michael@0: michael@0: EGLSurface fCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLSurface surf = mSymbols.fCreatePixmapSurface(dpy, config, pixmap, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return surf; michael@0: } michael@0: michael@0: EGLBoolean fBindAPI(EGLenum api) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fBindAPI(api); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fInitialize(dpy, major, minor); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fChooseConfig(dpy, attrib_list, configs, config_size, num_config); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLint fGetError() michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLint i = mSymbols.fGetError(); michael@0: AFTER_GL_CALL; michael@0: return i; michael@0: } michael@0: michael@0: EGLBoolean fGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fGetConfigAttrib(dpy, config, attribute, value); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fGetConfigs(dpy, configs, config_size, num_config); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fWaitNative(EGLint engine) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fWaitNative(engine); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLCastToRelevantPtr fGetProcAddress(const char *procname) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLCastToRelevantPtr p = mSymbols.fGetProcAddress(procname); michael@0: AFTER_GL_CALL; michael@0: return p; michael@0: } michael@0: michael@0: EGLBoolean fSwapBuffers(EGLDisplay dpy, EGLSurface surface) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fSwapBuffers(dpy, surface); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fCopyBuffers(dpy, surface, target); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: const GLubyte* fQueryString(EGLDisplay dpy, EGLint name) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: const GLubyte* b = mSymbols.fQueryString(dpy, name); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fQueryContext(dpy, ctx, attribute, value); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fBindTexImage(dpy, surface, buffer); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fReleaseTexImage(dpy, surface, buffer); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLImage fCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLImage i = mSymbols.fCreateImage(dpy, ctx, target, buffer, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return i; michael@0: } michael@0: michael@0: EGLBoolean fDestroyImage(EGLDisplay dpy, EGLImage image) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fDestroyImage(dpy, image); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: // New extension which allow us to lock texture and get raw image pointer michael@0: EGLBoolean fLockSurface(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fLockSurface(dpy, surface, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fUnlockSurface(EGLDisplay dpy, EGLSurface surface) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fUnlockSurface(dpy, surface); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fQuerySurface(dpy, surface, attribute, value); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLBoolean fQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fQuerySurfacePointerANGLE(dpy, surface, attribute, value); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLSync fCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLSync ret = mSymbols.fCreateSync(dpy, type, attrib_list); michael@0: AFTER_GL_CALL; michael@0: return ret; michael@0: } michael@0: michael@0: EGLBoolean fDestroySync(EGLDisplay dpy, EGLSync sync) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fDestroySync(dpy, sync); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: EGLint fClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLint ret = mSymbols.fClientWaitSync(dpy, sync, flags, timeout); michael@0: AFTER_GL_CALL; michael@0: return ret; michael@0: } michael@0: michael@0: EGLBoolean fGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value) michael@0: { michael@0: BEFORE_GL_CALL; michael@0: EGLBoolean b = mSymbols.fGetSyncAttrib(dpy, sync, attribute, value); michael@0: AFTER_GL_CALL; michael@0: return b; michael@0: } michael@0: michael@0: michael@0: EGLDisplay Display() { michael@0: return mEGLDisplay; michael@0: } michael@0: michael@0: bool IsANGLE() const { michael@0: return mIsANGLE; michael@0: } michael@0: michael@0: bool HasKHRImageBase() { michael@0: return IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base); michael@0: } michael@0: michael@0: bool HasKHRImagePixmap() { michael@0: return IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_pixmap); michael@0: } michael@0: michael@0: bool HasKHRImageTexture2D() { michael@0: return IsExtensionSupported(KHR_gl_texture_2D_image); michael@0: } michael@0: michael@0: bool HasANGLESurfaceD3DTexture2DShareHandle() { michael@0: return IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle); michael@0: } michael@0: michael@0: bool HasRobustness() const { michael@0: return IsExtensionSupported(EXT_create_context_robustness); michael@0: } michael@0: michael@0: bool EnsureInitialized(); michael@0: michael@0: void DumpEGLConfig(EGLConfig cfg); michael@0: void DumpEGLConfigs(); michael@0: michael@0: struct { michael@0: typedef EGLDisplay (GLAPIENTRY * pfnGetDisplay)(void *display_id); michael@0: pfnGetDisplay fGetDisplay; michael@0: typedef EGLSurface (GLAPIENTRY * pfnGetCurrentSurface)(EGLint); michael@0: pfnGetCurrentSurface fGetCurrentSurface; michael@0: typedef EGLContext (GLAPIENTRY * pfnGetCurrentContext)(void); michael@0: pfnGetCurrentContext fGetCurrentContext; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); michael@0: pfnMakeCurrent fMakeCurrent; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnDestroyContext)(EGLDisplay dpy, EGLContext ctx); michael@0: pfnDestroyContext fDestroyContext; michael@0: typedef EGLContext (GLAPIENTRY * pfnCreateContext)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); michael@0: pfnCreateContext fCreateContext; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnDestroySurface)(EGLDisplay dpy, EGLSurface surface); michael@0: pfnDestroySurface fDestroySurface; michael@0: typedef EGLSurface (GLAPIENTRY * pfnCreateWindowSurface)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); michael@0: pfnCreateWindowSurface fCreateWindowSurface; michael@0: typedef EGLSurface (GLAPIENTRY * pfnCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); michael@0: pfnCreatePbufferSurface fCreatePbufferSurface; michael@0: typedef EGLSurface (GLAPIENTRY * pfnCreatePixmapSurface)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); michael@0: pfnCreatePixmapSurface fCreatePixmapSurface; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnBindAPI)(EGLenum api); michael@0: pfnBindAPI fBindAPI; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor); michael@0: pfnInitialize fInitialize; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); michael@0: pfnChooseConfig fChooseConfig; michael@0: typedef EGLint (GLAPIENTRY * pfnGetError)(void); michael@0: pfnGetError fGetError; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnGetConfigAttrib)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); michael@0: pfnGetConfigAttrib fGetConfigAttrib; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnGetConfigs)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); michael@0: pfnGetConfigs fGetConfigs; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnWaitNative)(EGLint engine); michael@0: pfnWaitNative fWaitNative; michael@0: typedef EGLCastToRelevantPtr (GLAPIENTRY * pfnGetProcAddress)(const char *procname); michael@0: pfnGetProcAddress fGetProcAddress; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnSwapBuffers)(EGLDisplay dpy, EGLSurface surface); michael@0: pfnSwapBuffers fSwapBuffers; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnCopyBuffers)(EGLDisplay dpy, EGLSurface surface, michael@0: EGLNativePixmapType target); michael@0: pfnCopyBuffers fCopyBuffers; michael@0: typedef const GLubyte* (GLAPIENTRY * pfnQueryString)(EGLDisplay, EGLint name); michael@0: pfnQueryString fQueryString; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnQueryContext)(EGLDisplay dpy, EGLContext ctx, michael@0: EGLint attribute, EGLint *value); michael@0: pfnQueryContext fQueryContext; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnBindTexImage)(EGLDisplay, EGLSurface surface, EGLint buffer); michael@0: pfnBindTexImage fBindTexImage; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnReleaseTexImage)(EGLDisplay, EGLSurface surface, EGLint buffer); michael@0: pfnReleaseTexImage fReleaseTexImage; michael@0: typedef EGLImage (GLAPIENTRY * pfnCreateImage)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); michael@0: pfnCreateImage fCreateImage; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnDestroyImage)(EGLDisplay dpy, EGLImage image); michael@0: pfnDestroyImage fDestroyImage; michael@0: michael@0: // New extension which allow us to lock texture and get raw image pointer michael@0: typedef EGLBoolean (GLAPIENTRY * pfnLockSurface)(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); michael@0: pfnLockSurface fLockSurface; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnUnlockSurface)(EGLDisplay dpy, EGLSurface surface); michael@0: pfnUnlockSurface fUnlockSurface; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnQuerySurface)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); michael@0: pfnQuerySurface fQuerySurface; michael@0: michael@0: typedef EGLBoolean (GLAPIENTRY * pfnQuerySurfacePointerANGLE)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); michael@0: pfnQuerySurfacePointerANGLE fQuerySurfacePointerANGLE; michael@0: michael@0: typedef EGLSync (GLAPIENTRY * pfnCreateSync)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); michael@0: pfnCreateSync fCreateSync; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnDestroySync)(EGLDisplay dpy, EGLSync sync); michael@0: pfnDestroySync fDestroySync; michael@0: typedef EGLint (GLAPIENTRY * pfnClientWaitSync)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); michael@0: pfnClientWaitSync fClientWaitSync; michael@0: typedef EGLBoolean (GLAPIENTRY * pfnGetSyncAttrib)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value); michael@0: pfnGetSyncAttrib fGetSyncAttrib; michael@0: } mSymbols; michael@0: michael@0: #ifdef DEBUG michael@0: static void BeforeGLCall(const char* glFunction); michael@0: static void AfterGLCall(const char* glFunction); michael@0: #endif michael@0: michael@0: private: michael@0: bool mInitialized; michael@0: PRLibrary* mEGLLibrary; michael@0: EGLDisplay mEGLDisplay; michael@0: michael@0: bool mIsANGLE; michael@0: }; michael@0: michael@0: extern GLLibraryEGL sEGLLibrary; michael@0: #define EGL_DISPLAY() sEGLLibrary.Display() michael@0: michael@0: } /* namespace gl */ michael@0: } /* namespace mozilla */ michael@0: michael@0: #endif /* GLLIBRARYEGL_H_ */ michael@0: