gfx/gl/GLLibraryEGL.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef GLLIBRARYEGL_H_
michael@0 6 #define GLLIBRARYEGL_H_
michael@0 7
michael@0 8 #if defined(MOZ_X11)
michael@0 9 #include "mozilla/X11Util.h"
michael@0 10 #endif
michael@0 11
michael@0 12 #include "GLLibraryLoader.h"
michael@0 13
michael@0 14 #include "nsIFile.h"
michael@0 15
michael@0 16 #include <bitset>
michael@0 17
michael@0 18 #if defined(XP_WIN)
michael@0 19
michael@0 20 #ifndef WIN32_LEAN_AND_MEAN
michael@0 21 #define WIN32_LEAN_AND_MEAN 1
michael@0 22 #endif
michael@0 23
michael@0 24 #include <windows.h>
michael@0 25
michael@0 26 typedef HDC EGLNativeDisplayType;
michael@0 27 typedef HBITMAP EGLNativePixmapType;
michael@0 28 typedef HWND EGLNativeWindowType;
michael@0 29
michael@0 30 #define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
michael@0 31
michael@0 32 #else
michael@0 33 typedef void *EGLNativeDisplayType;
michael@0 34 typedef void *EGLNativePixmapType;
michael@0 35 typedef void *EGLNativeWindowType;
michael@0 36
michael@0 37 #ifdef ANDROID
michael@0 38 // We only need to explicitly dlopen egltrace
michael@0 39 // on android as we can use LD_PRELOAD or other tricks
michael@0 40 // on other platforms. We look for it in /data/local
michael@0 41 // as that's writeable by all users
michael@0 42 //
michael@0 43 // This should really go in GLLibraryEGL.cpp but we currently reference
michael@0 44 // APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring
michael@0 45 // will come in subsequent patches on Bug 732865
michael@0 46 #define APITRACE_LIB "/data/local/tmp/egltrace.so"
michael@0 47
michael@0 48 #ifdef MOZ_WIDGET_ANDROID
michael@0 49
michael@0 50 #endif // MOZ_WIDGET_ANDROID
michael@0 51 #endif // ANDROID
michael@0 52 #endif
michael@0 53
michael@0 54 #if defined(MOZ_X11)
michael@0 55 #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)mozilla::DefaultXDisplay())
michael@0 56 #else
michael@0 57 #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
michael@0 58 #endif
michael@0 59
michael@0 60 namespace mozilla {
michael@0 61 namespace gl {
michael@0 62
michael@0 63 #undef BEFORE_GL_CALL
michael@0 64 #undef AFTER_GL_CALL
michael@0 65
michael@0 66 #ifdef DEBUG
michael@0 67
michael@0 68 #ifndef MOZ_FUNCTION_NAME
michael@0 69 # ifdef __GNUC__
michael@0 70 # define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__
michael@0 71 # elif defined(_MSC_VER)
michael@0 72 # define MOZ_FUNCTION_NAME __FUNCTION__
michael@0 73 # else
michael@0 74 # define MOZ_FUNCTION_NAME __func__ // defined in C99, supported in various C++ compilers. Just raw function name.
michael@0 75 # endif
michael@0 76 #endif
michael@0 77
michael@0 78 #define BEFORE_GL_CALL do { \
michael@0 79 BeforeGLCall(MOZ_FUNCTION_NAME); \
michael@0 80 } while (0)
michael@0 81
michael@0 82 #define AFTER_GL_CALL do { \
michael@0 83 AfterGLCall(MOZ_FUNCTION_NAME); \
michael@0 84 } while (0)
michael@0 85 // We rely on the fact that GLLibraryEGL.h #defines BEFORE_GL_CALL and
michael@0 86 // AFTER_GL_CALL to nothing if !defined(DEBUG).
michael@0 87 #else
michael@0 88 #define BEFORE_GL_CALL
michael@0 89 #define AFTER_GL_CALL
michael@0 90 #endif
michael@0 91
michael@0 92 class GLLibraryEGL
michael@0 93 {
michael@0 94 public:
michael@0 95 GLLibraryEGL()
michael@0 96 : mInitialized(false),
michael@0 97 mEGLLibrary(nullptr),
michael@0 98 mIsANGLE(false)
michael@0 99 {
michael@0 100 }
michael@0 101
michael@0 102 void InitExtensions();
michael@0 103
michael@0 104 /**
michael@0 105 * Known GL extensions that can be queried by
michael@0 106 * IsExtensionSupported. The results of this are cached, and as
michael@0 107 * such it's safe to use this even in performance critical code.
michael@0 108 * If you add to this array, remember to add to the string names
michael@0 109 * in GLContext.cpp.
michael@0 110 */
michael@0 111 enum EGLExtensions {
michael@0 112 KHR_image_base,
michael@0 113 KHR_image_pixmap,
michael@0 114 KHR_gl_texture_2D_image,
michael@0 115 KHR_lock_surface,
michael@0 116 ANGLE_surface_d3d_texture_2d_share_handle,
michael@0 117 EXT_create_context_robustness,
michael@0 118 KHR_image,
michael@0 119 KHR_fence_sync,
michael@0 120 Extensions_Max
michael@0 121 };
michael@0 122
michael@0 123 bool IsExtensionSupported(EGLExtensions aKnownExtension) const {
michael@0 124 return mAvailableExtensions[aKnownExtension];
michael@0 125 }
michael@0 126
michael@0 127 void MarkExtensionUnsupported(EGLExtensions aKnownExtension) {
michael@0 128 mAvailableExtensions[aKnownExtension] = false;
michael@0 129 }
michael@0 130
michael@0 131 protected:
michael@0 132 std::bitset<Extensions_Max> mAvailableExtensions;
michael@0 133
michael@0 134 public:
michael@0 135
michael@0 136 EGLDisplay fGetDisplay(void* display_id)
michael@0 137 {
michael@0 138 BEFORE_GL_CALL;
michael@0 139 EGLDisplay disp = mSymbols.fGetDisplay(display_id);
michael@0 140 AFTER_GL_CALL;
michael@0 141 return disp;
michael@0 142 }
michael@0 143
michael@0 144 EGLSurface fGetCurrentSurface(EGLint id)
michael@0 145 {
michael@0 146 BEFORE_GL_CALL;
michael@0 147 EGLSurface surf = mSymbols.fGetCurrentSurface(id);
michael@0 148 AFTER_GL_CALL;
michael@0 149 return surf;
michael@0 150 }
michael@0 151
michael@0 152 EGLContext fGetCurrentContext()
michael@0 153 {
michael@0 154 BEFORE_GL_CALL;
michael@0 155 EGLContext context = mSymbols.fGetCurrentContext();
michael@0 156 AFTER_GL_CALL;
michael@0 157 return context;
michael@0 158 }
michael@0 159
michael@0 160 EGLBoolean fMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
michael@0 161 {
michael@0 162 BEFORE_GL_CALL;
michael@0 163 EGLBoolean b = mSymbols.fMakeCurrent(dpy, draw, read, ctx);
michael@0 164 AFTER_GL_CALL;
michael@0 165 return b;
michael@0 166 }
michael@0 167
michael@0 168 EGLBoolean fDestroyContext(EGLDisplay dpy, EGLContext ctx)
michael@0 169 {
michael@0 170 BEFORE_GL_CALL;
michael@0 171 EGLBoolean b = mSymbols.fDestroyContext(dpy, ctx);
michael@0 172 AFTER_GL_CALL;
michael@0 173 return b;
michael@0 174 }
michael@0 175
michael@0 176 EGLContext fCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
michael@0 177 {
michael@0 178 BEFORE_GL_CALL;
michael@0 179 EGLContext ctx = mSymbols.fCreateContext(dpy, config, share_context, attrib_list);
michael@0 180 AFTER_GL_CALL;
michael@0 181 return ctx;
michael@0 182 }
michael@0 183
michael@0 184 EGLBoolean fDestroySurface(EGLDisplay dpy, EGLSurface surface)
michael@0 185 {
michael@0 186 BEFORE_GL_CALL;
michael@0 187 EGLBoolean b = mSymbols.fDestroySurface(dpy, surface);
michael@0 188 AFTER_GL_CALL;
michael@0 189 return b;
michael@0 190 }
michael@0 191
michael@0 192 EGLSurface fCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
michael@0 193 {
michael@0 194 BEFORE_GL_CALL;
michael@0 195 EGLSurface surf = mSymbols.fCreateWindowSurface(dpy, config, win, attrib_list);
michael@0 196 AFTER_GL_CALL;
michael@0 197 return surf;
michael@0 198 }
michael@0 199
michael@0 200 EGLSurface fCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
michael@0 201 {
michael@0 202 BEFORE_GL_CALL;
michael@0 203 EGLSurface surf = mSymbols.fCreatePbufferSurface(dpy, config, attrib_list);
michael@0 204 AFTER_GL_CALL;
michael@0 205 return surf;
michael@0 206 }
michael@0 207
michael@0 208 EGLSurface fCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
michael@0 209 {
michael@0 210 BEFORE_GL_CALL;
michael@0 211 EGLSurface surf = mSymbols.fCreatePixmapSurface(dpy, config, pixmap, attrib_list);
michael@0 212 AFTER_GL_CALL;
michael@0 213 return surf;
michael@0 214 }
michael@0 215
michael@0 216 EGLBoolean fBindAPI(EGLenum api)
michael@0 217 {
michael@0 218 BEFORE_GL_CALL;
michael@0 219 EGLBoolean b = mSymbols.fBindAPI(api);
michael@0 220 AFTER_GL_CALL;
michael@0 221 return b;
michael@0 222 }
michael@0 223
michael@0 224 EGLBoolean fInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
michael@0 225 {
michael@0 226 BEFORE_GL_CALL;
michael@0 227 EGLBoolean b = mSymbols.fInitialize(dpy, major, minor);
michael@0 228 AFTER_GL_CALL;
michael@0 229 return b;
michael@0 230 }
michael@0 231
michael@0 232 EGLBoolean fChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
michael@0 233 {
michael@0 234 BEFORE_GL_CALL;
michael@0 235 EGLBoolean b = mSymbols.fChooseConfig(dpy, attrib_list, configs, config_size, num_config);
michael@0 236 AFTER_GL_CALL;
michael@0 237 return b;
michael@0 238 }
michael@0 239
michael@0 240 EGLint fGetError()
michael@0 241 {
michael@0 242 BEFORE_GL_CALL;
michael@0 243 EGLint i = mSymbols.fGetError();
michael@0 244 AFTER_GL_CALL;
michael@0 245 return i;
michael@0 246 }
michael@0 247
michael@0 248 EGLBoolean fGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
michael@0 249 {
michael@0 250 BEFORE_GL_CALL;
michael@0 251 EGLBoolean b = mSymbols.fGetConfigAttrib(dpy, config, attribute, value);
michael@0 252 AFTER_GL_CALL;
michael@0 253 return b;
michael@0 254 }
michael@0 255
michael@0 256 EGLBoolean fGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
michael@0 257 {
michael@0 258 BEFORE_GL_CALL;
michael@0 259 EGLBoolean b = mSymbols.fGetConfigs(dpy, configs, config_size, num_config);
michael@0 260 AFTER_GL_CALL;
michael@0 261 return b;
michael@0 262 }
michael@0 263
michael@0 264 EGLBoolean fWaitNative(EGLint engine)
michael@0 265 {
michael@0 266 BEFORE_GL_CALL;
michael@0 267 EGLBoolean b = mSymbols.fWaitNative(engine);
michael@0 268 AFTER_GL_CALL;
michael@0 269 return b;
michael@0 270 }
michael@0 271
michael@0 272 EGLCastToRelevantPtr fGetProcAddress(const char *procname)
michael@0 273 {
michael@0 274 BEFORE_GL_CALL;
michael@0 275 EGLCastToRelevantPtr p = mSymbols.fGetProcAddress(procname);
michael@0 276 AFTER_GL_CALL;
michael@0 277 return p;
michael@0 278 }
michael@0 279
michael@0 280 EGLBoolean fSwapBuffers(EGLDisplay dpy, EGLSurface surface)
michael@0 281 {
michael@0 282 BEFORE_GL_CALL;
michael@0 283 EGLBoolean b = mSymbols.fSwapBuffers(dpy, surface);
michael@0 284 AFTER_GL_CALL;
michael@0 285 return b;
michael@0 286 }
michael@0 287
michael@0 288 EGLBoolean fCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
michael@0 289 {
michael@0 290 BEFORE_GL_CALL;
michael@0 291 EGLBoolean b = mSymbols.fCopyBuffers(dpy, surface, target);
michael@0 292 AFTER_GL_CALL;
michael@0 293 return b;
michael@0 294 }
michael@0 295
michael@0 296 const GLubyte* fQueryString(EGLDisplay dpy, EGLint name)
michael@0 297 {
michael@0 298 BEFORE_GL_CALL;
michael@0 299 const GLubyte* b = mSymbols.fQueryString(dpy, name);
michael@0 300 AFTER_GL_CALL;
michael@0 301 return b;
michael@0 302 }
michael@0 303
michael@0 304 EGLBoolean fQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
michael@0 305 {
michael@0 306 BEFORE_GL_CALL;
michael@0 307 EGLBoolean b = mSymbols.fQueryContext(dpy, ctx, attribute, value);
michael@0 308 AFTER_GL_CALL;
michael@0 309 return b;
michael@0 310 }
michael@0 311
michael@0 312 EGLBoolean fBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
michael@0 313 {
michael@0 314 BEFORE_GL_CALL;
michael@0 315 EGLBoolean b = mSymbols.fBindTexImage(dpy, surface, buffer);
michael@0 316 AFTER_GL_CALL;
michael@0 317 return b;
michael@0 318 }
michael@0 319
michael@0 320 EGLBoolean fReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
michael@0 321 {
michael@0 322 BEFORE_GL_CALL;
michael@0 323 EGLBoolean b = mSymbols.fReleaseTexImage(dpy, surface, buffer);
michael@0 324 AFTER_GL_CALL;
michael@0 325 return b;
michael@0 326 }
michael@0 327
michael@0 328 EGLImage fCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
michael@0 329 {
michael@0 330 BEFORE_GL_CALL;
michael@0 331 EGLImage i = mSymbols.fCreateImage(dpy, ctx, target, buffer, attrib_list);
michael@0 332 AFTER_GL_CALL;
michael@0 333 return i;
michael@0 334 }
michael@0 335
michael@0 336 EGLBoolean fDestroyImage(EGLDisplay dpy, EGLImage image)
michael@0 337 {
michael@0 338 BEFORE_GL_CALL;
michael@0 339 EGLBoolean b = mSymbols.fDestroyImage(dpy, image);
michael@0 340 AFTER_GL_CALL;
michael@0 341 return b;
michael@0 342 }
michael@0 343
michael@0 344 // New extension which allow us to lock texture and get raw image pointer
michael@0 345 EGLBoolean fLockSurface(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list)
michael@0 346 {
michael@0 347 BEFORE_GL_CALL;
michael@0 348 EGLBoolean b = mSymbols.fLockSurface(dpy, surface, attrib_list);
michael@0 349 AFTER_GL_CALL;
michael@0 350 return b;
michael@0 351 }
michael@0 352
michael@0 353 EGLBoolean fUnlockSurface(EGLDisplay dpy, EGLSurface surface)
michael@0 354 {
michael@0 355 BEFORE_GL_CALL;
michael@0 356 EGLBoolean b = mSymbols.fUnlockSurface(dpy, surface);
michael@0 357 AFTER_GL_CALL;
michael@0 358 return b;
michael@0 359 }
michael@0 360
michael@0 361 EGLBoolean fQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
michael@0 362 {
michael@0 363 BEFORE_GL_CALL;
michael@0 364 EGLBoolean b = mSymbols.fQuerySurface(dpy, surface, attribute, value);
michael@0 365 AFTER_GL_CALL;
michael@0 366 return b;
michael@0 367 }
michael@0 368
michael@0 369 EGLBoolean fQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
michael@0 370 {
michael@0 371 BEFORE_GL_CALL;
michael@0 372 EGLBoolean b = mSymbols.fQuerySurfacePointerANGLE(dpy, surface, attribute, value);
michael@0 373 AFTER_GL_CALL;
michael@0 374 return b;
michael@0 375 }
michael@0 376
michael@0 377 EGLSync fCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
michael@0 378 {
michael@0 379 BEFORE_GL_CALL;
michael@0 380 EGLSync ret = mSymbols.fCreateSync(dpy, type, attrib_list);
michael@0 381 AFTER_GL_CALL;
michael@0 382 return ret;
michael@0 383 }
michael@0 384
michael@0 385 EGLBoolean fDestroySync(EGLDisplay dpy, EGLSync sync)
michael@0 386 {
michael@0 387 BEFORE_GL_CALL;
michael@0 388 EGLBoolean b = mSymbols.fDestroySync(dpy, sync);
michael@0 389 AFTER_GL_CALL;
michael@0 390 return b;
michael@0 391 }
michael@0 392
michael@0 393 EGLint fClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
michael@0 394 {
michael@0 395 BEFORE_GL_CALL;
michael@0 396 EGLint ret = mSymbols.fClientWaitSync(dpy, sync, flags, timeout);
michael@0 397 AFTER_GL_CALL;
michael@0 398 return ret;
michael@0 399 }
michael@0 400
michael@0 401 EGLBoolean fGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value)
michael@0 402 {
michael@0 403 BEFORE_GL_CALL;
michael@0 404 EGLBoolean b = mSymbols.fGetSyncAttrib(dpy, sync, attribute, value);
michael@0 405 AFTER_GL_CALL;
michael@0 406 return b;
michael@0 407 }
michael@0 408
michael@0 409
michael@0 410 EGLDisplay Display() {
michael@0 411 return mEGLDisplay;
michael@0 412 }
michael@0 413
michael@0 414 bool IsANGLE() const {
michael@0 415 return mIsANGLE;
michael@0 416 }
michael@0 417
michael@0 418 bool HasKHRImageBase() {
michael@0 419 return IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base);
michael@0 420 }
michael@0 421
michael@0 422 bool HasKHRImagePixmap() {
michael@0 423 return IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_pixmap);
michael@0 424 }
michael@0 425
michael@0 426 bool HasKHRImageTexture2D() {
michael@0 427 return IsExtensionSupported(KHR_gl_texture_2D_image);
michael@0 428 }
michael@0 429
michael@0 430 bool HasANGLESurfaceD3DTexture2DShareHandle() {
michael@0 431 return IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle);
michael@0 432 }
michael@0 433
michael@0 434 bool HasRobustness() const {
michael@0 435 return IsExtensionSupported(EXT_create_context_robustness);
michael@0 436 }
michael@0 437
michael@0 438 bool EnsureInitialized();
michael@0 439
michael@0 440 void DumpEGLConfig(EGLConfig cfg);
michael@0 441 void DumpEGLConfigs();
michael@0 442
michael@0 443 struct {
michael@0 444 typedef EGLDisplay (GLAPIENTRY * pfnGetDisplay)(void *display_id);
michael@0 445 pfnGetDisplay fGetDisplay;
michael@0 446 typedef EGLSurface (GLAPIENTRY * pfnGetCurrentSurface)(EGLint);
michael@0 447 pfnGetCurrentSurface fGetCurrentSurface;
michael@0 448 typedef EGLContext (GLAPIENTRY * pfnGetCurrentContext)(void);
michael@0 449 pfnGetCurrentContext fGetCurrentContext;
michael@0 450 typedef EGLBoolean (GLAPIENTRY * pfnMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
michael@0 451 pfnMakeCurrent fMakeCurrent;
michael@0 452 typedef EGLBoolean (GLAPIENTRY * pfnDestroyContext)(EGLDisplay dpy, EGLContext ctx);
michael@0 453 pfnDestroyContext fDestroyContext;
michael@0 454 typedef EGLContext (GLAPIENTRY * pfnCreateContext)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
michael@0 455 pfnCreateContext fCreateContext;
michael@0 456 typedef EGLBoolean (GLAPIENTRY * pfnDestroySurface)(EGLDisplay dpy, EGLSurface surface);
michael@0 457 pfnDestroySurface fDestroySurface;
michael@0 458 typedef EGLSurface (GLAPIENTRY * pfnCreateWindowSurface)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
michael@0 459 pfnCreateWindowSurface fCreateWindowSurface;
michael@0 460 typedef EGLSurface (GLAPIENTRY * pfnCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
michael@0 461 pfnCreatePbufferSurface fCreatePbufferSurface;
michael@0 462 typedef EGLSurface (GLAPIENTRY * pfnCreatePixmapSurface)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
michael@0 463 pfnCreatePixmapSurface fCreatePixmapSurface;
michael@0 464 typedef EGLBoolean (GLAPIENTRY * pfnBindAPI)(EGLenum api);
michael@0 465 pfnBindAPI fBindAPI;
michael@0 466 typedef EGLBoolean (GLAPIENTRY * pfnInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor);
michael@0 467 pfnInitialize fInitialize;
michael@0 468 typedef EGLBoolean (GLAPIENTRY * pfnChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
michael@0 469 pfnChooseConfig fChooseConfig;
michael@0 470 typedef EGLint (GLAPIENTRY * pfnGetError)(void);
michael@0 471 pfnGetError fGetError;
michael@0 472 typedef EGLBoolean (GLAPIENTRY * pfnGetConfigAttrib)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
michael@0 473 pfnGetConfigAttrib fGetConfigAttrib;
michael@0 474 typedef EGLBoolean (GLAPIENTRY * pfnGetConfigs)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
michael@0 475 pfnGetConfigs fGetConfigs;
michael@0 476 typedef EGLBoolean (GLAPIENTRY * pfnWaitNative)(EGLint engine);
michael@0 477 pfnWaitNative fWaitNative;
michael@0 478 typedef EGLCastToRelevantPtr (GLAPIENTRY * pfnGetProcAddress)(const char *procname);
michael@0 479 pfnGetProcAddress fGetProcAddress;
michael@0 480 typedef EGLBoolean (GLAPIENTRY * pfnSwapBuffers)(EGLDisplay dpy, EGLSurface surface);
michael@0 481 pfnSwapBuffers fSwapBuffers;
michael@0 482 typedef EGLBoolean (GLAPIENTRY * pfnCopyBuffers)(EGLDisplay dpy, EGLSurface surface,
michael@0 483 EGLNativePixmapType target);
michael@0 484 pfnCopyBuffers fCopyBuffers;
michael@0 485 typedef const GLubyte* (GLAPIENTRY * pfnQueryString)(EGLDisplay, EGLint name);
michael@0 486 pfnQueryString fQueryString;
michael@0 487 typedef EGLBoolean (GLAPIENTRY * pfnQueryContext)(EGLDisplay dpy, EGLContext ctx,
michael@0 488 EGLint attribute, EGLint *value);
michael@0 489 pfnQueryContext fQueryContext;
michael@0 490 typedef EGLBoolean (GLAPIENTRY * pfnBindTexImage)(EGLDisplay, EGLSurface surface, EGLint buffer);
michael@0 491 pfnBindTexImage fBindTexImage;
michael@0 492 typedef EGLBoolean (GLAPIENTRY * pfnReleaseTexImage)(EGLDisplay, EGLSurface surface, EGLint buffer);
michael@0 493 pfnReleaseTexImage fReleaseTexImage;
michael@0 494 typedef EGLImage (GLAPIENTRY * pfnCreateImage)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
michael@0 495 pfnCreateImage fCreateImage;
michael@0 496 typedef EGLBoolean (GLAPIENTRY * pfnDestroyImage)(EGLDisplay dpy, EGLImage image);
michael@0 497 pfnDestroyImage fDestroyImage;
michael@0 498
michael@0 499 // New extension which allow us to lock texture and get raw image pointer
michael@0 500 typedef EGLBoolean (GLAPIENTRY * pfnLockSurface)(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
michael@0 501 pfnLockSurface fLockSurface;
michael@0 502 typedef EGLBoolean (GLAPIENTRY * pfnUnlockSurface)(EGLDisplay dpy, EGLSurface surface);
michael@0 503 pfnUnlockSurface fUnlockSurface;
michael@0 504 typedef EGLBoolean (GLAPIENTRY * pfnQuerySurface)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
michael@0 505 pfnQuerySurface fQuerySurface;
michael@0 506
michael@0 507 typedef EGLBoolean (GLAPIENTRY * pfnQuerySurfacePointerANGLE)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
michael@0 508 pfnQuerySurfacePointerANGLE fQuerySurfacePointerANGLE;
michael@0 509
michael@0 510 typedef EGLSync (GLAPIENTRY * pfnCreateSync)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
michael@0 511 pfnCreateSync fCreateSync;
michael@0 512 typedef EGLBoolean (GLAPIENTRY * pfnDestroySync)(EGLDisplay dpy, EGLSync sync);
michael@0 513 pfnDestroySync fDestroySync;
michael@0 514 typedef EGLint (GLAPIENTRY * pfnClientWaitSync)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
michael@0 515 pfnClientWaitSync fClientWaitSync;
michael@0 516 typedef EGLBoolean (GLAPIENTRY * pfnGetSyncAttrib)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value);
michael@0 517 pfnGetSyncAttrib fGetSyncAttrib;
michael@0 518 } mSymbols;
michael@0 519
michael@0 520 #ifdef DEBUG
michael@0 521 static void BeforeGLCall(const char* glFunction);
michael@0 522 static void AfterGLCall(const char* glFunction);
michael@0 523 #endif
michael@0 524
michael@0 525 private:
michael@0 526 bool mInitialized;
michael@0 527 PRLibrary* mEGLLibrary;
michael@0 528 EGLDisplay mEGLDisplay;
michael@0 529
michael@0 530 bool mIsANGLE;
michael@0 531 };
michael@0 532
michael@0 533 extern GLLibraryEGL sEGLLibrary;
michael@0 534 #define EGL_DISPLAY() sEGLLibrary.Display()
michael@0 535
michael@0 536 } /* namespace gl */
michael@0 537 } /* namespace mozilla */
michael@0 538
michael@0 539 #endif /* GLLIBRARYEGL_H_ */
michael@0 540

mercurial