• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 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 // DisplayEAGL.h: EAGL implementation of egl::Display
8 
9 #ifndef LIBANGLE_RENDERER_GL_EAGL_DISPLAYEAGL_H_
10 #define LIBANGLE_RENDERER_GL_EAGL_DISPLAYEAGL_H_
11 
12 #include "libANGLE/renderer/gl/DisplayGL.h"
13 
14 #ifdef __OBJC__
15 @class EAGLContext;
16 typedef EAGLContext *EAGLContextObj;
17 #else
18 typedef void *EAGLContextObj;
19 #endif
20 
21 namespace rx
22 {
23 
24 class WorkerContext;
25 
26 class DisplayEAGL : public DisplayGL
27 {
28   public:
29     DisplayEAGL(const egl::DisplayState &state);
30     ~DisplayEAGL() override;
31 
32     egl::Error initialize(egl::Display *display) override;
33     void terminate() override;
34 
35     SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
36                                      EGLNativeWindowType window,
37                                      const egl::AttributeMap &attribs) override;
38     SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
39                                       const egl::AttributeMap &attribs) override;
40     SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
41                                                EGLenum buftype,
42                                                EGLClientBuffer clientBuffer,
43                                                const egl::AttributeMap &attribs) override;
44     SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
45                                      NativePixmapType nativePixmap,
46                                      const egl::AttributeMap &attribs) override;
47 
48     ContextImpl *createContext(const gl::State &state,
49                                gl::ErrorSet *errorSet,
50                                const egl::Config *configuration,
51                                const gl::Context *shareContext,
52                                const egl::AttributeMap &attribs) override;
53 
54     egl::ConfigSet generateConfigs() override;
55 
56     bool testDeviceLost() override;
57     egl::Error restoreLostDevice(const egl::Display *display) override;
58 
59     bool isValidNativeWindow(EGLNativeWindowType window) const override;
60     egl::Error validateClientBuffer(const egl::Config *configuration,
61                                     EGLenum buftype,
62                                     EGLClientBuffer clientBuffer,
63                                     const egl::AttributeMap &attribs) const override;
64 
65     DeviceImpl *createDevice() override;
66 
67     std::string getVendorString() const override;
68 
69     egl::Error waitClient(const gl::Context *context) override;
70     egl::Error waitNative(const gl::Context *context, EGLint engine) override;
71 
72     gl::Version getMaxSupportedESVersion() const override;
73 
74     EAGLContextObj getEAGLContext() const;
75 
76     WorkerContext *createWorkerContext(std::string *infoLog);
77 
78     void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
79 
80     void populateFeatureList(angle::FeatureList *features) override;
81 
82   private:
83     egl::Error makeCurrentSurfaceless(gl::Context *context) override;
84 
85     void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
86     void generateCaps(egl::Caps *outCaps) const override;
87 
88     std::shared_ptr<RendererGL> mRenderer;
89 
90     egl::Display *mEGLDisplay;
91     EAGLContextObj mContext;
92 };
93 
94 }  // namespace rx
95 
96 #endif  // LIBANGLE_RENDERER_GL_EAGL_DISPLAYEAGL_H_
97