• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // DisplayAndroid.h: Android implementation of egl::Display
8 
9 #ifndef LIBANGLE_RENDERER_GL_EGL_ANDROID_DISPLAYANDROID_H_
10 #define LIBANGLE_RENDERER_GL_EGL_ANDROID_DISPLAYANDROID_H_
11 
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 #include "libANGLE/renderer/gl/egl/DisplayEGL.h"
17 
18 namespace rx
19 {
20 
21 class RendererEGL;
22 
23 class DisplayAndroid : public DisplayEGL
24 {
25   public:
26     DisplayAndroid(const egl::DisplayState &state);
27     ~DisplayAndroid() override;
28 
29     egl::Error initialize(egl::Display *display) override;
30     void terminate() override;
31 
32     ContextImpl *createContext(const gl::State &state,
33                                gl::ErrorSet *errorSet,
34                                const egl::Config *configuration,
35                                const gl::Context *shareContext,
36                                const egl::AttributeMap &attribs) override;
37     SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
38                                                EGLenum buftype,
39                                                EGLClientBuffer clientBuffer,
40                                                const egl::AttributeMap &attribs) override;
41     bool isValidNativeWindow(EGLNativeWindowType window) const override;
42     egl::Error validateClientBuffer(const egl::Config *configuration,
43                                     EGLenum buftype,
44                                     EGLClientBuffer clientBuffer,
45                                     const egl::AttributeMap &attribs) const override;
46     egl::Error validateImageClientBuffer(const gl::Context *context,
47                                          EGLenum target,
48                                          EGLClientBuffer clientBuffer,
49                                          const egl::AttributeMap &attribs) const override;
50 
51     ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
52                                                          EGLenum target,
53                                                          EGLClientBuffer buffer,
54                                                          const egl::AttributeMap &attribs) override;
55 
56     egl::Error makeCurrent(egl::Display *display,
57                            egl::Surface *drawSurface,
58                            egl::Surface *readSurface,
59                            gl::Context *context) override;
60 
61     void destroyNativeContext(EGLContext context) override;
62 
63     WorkerContext *createWorkerContext(std::string *infoLog,
64                                        EGLContext sharedContext,
65                                        const native_egl::AttributeVector workerAttribs) override;
66 
67   private:
68     void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
69 
70     egl::Error createRenderer(EGLContext shareContext,
71                               bool makeNewContextCurrent,
72                               bool isExternalContext,
73                               std::shared_ptr<RendererEGL> *outRenderer);
74 
75     bool mVirtualizedContexts;
76 
77     bool mSupportsSurfaceless;
78 
79     EGLSurface mMockPbuffer;
80 };
81 
82 }  // namespace rx
83 
84 #endif  // LIBANGLE_RENDERER_GL_EGL_ANDROID_DISPLAYANDROID_H_
85