Line data Source code
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
3 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef EGLUTILS_H_
6 : #define EGLUTILS_H_
7 :
8 : #include "GLContextTypes.h"
9 : #include "GLTypes.h"
10 : #include "mozilla/Assertions.h"
11 :
12 : namespace mozilla {
13 : namespace gl {
14 :
15 : class GLLibraryEGL;
16 :
17 : bool DoesEGLContextSupportSharingWithEGLImage(GLContext* gl);
18 : EGLImage CreateEGLImage(GLContext* gl, GLuint tex);
19 :
20 : ////////////////////////////////////////////////////////////////////////
21 : // EGLImageWrapper
22 :
23 : class EGLImageWrapper
24 : {
25 : public:
26 : static EGLImageWrapper* Create(GLContext* gl, GLuint tex);
27 :
28 : private:
29 : GLLibraryEGL& mLibrary;
30 : const EGLDisplay mDisplay;
31 : public:
32 : const EGLImage mImage;
33 : private:
34 : EGLSync mSync;
35 :
36 0 : EGLImageWrapper(GLLibraryEGL& library,
37 : EGLDisplay display,
38 : EGLImage image)
39 0 : : mLibrary(library)
40 : , mDisplay(display)
41 : , mImage(image)
42 0 : , mSync(0)
43 : {
44 0 : MOZ_ASSERT(mImage);
45 0 : }
46 :
47 : public:
48 : ~EGLImageWrapper();
49 :
50 : // Insert a sync point on the given context, which should be the current active
51 : // context.
52 : bool FenceSync(GLContext* gl);
53 :
54 : bool ClientWaitSync();
55 : };
56 :
57 : } // namespace gl
58 : } // namespace mozilla
59 :
60 : #endif
|