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