gl_context_egl.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_CONTEXT_EGL_H_
  5. #define UI_GL_GL_CONTEXT_EGL_H_
  6. #include <map>
  7. #include "base/memory/raw_ptr.h"
  8. #include "ui/gl/gl_context.h"
  9. #include "ui/gl/gl_export.h"
  10. typedef void* EGLContext;
  11. typedef void* EGLConfig;
  12. namespace gl {
  13. class GLDisplayEGL;
  14. class GLSurface;
  15. // Encapsulates an EGL OpenGL ES context.
  16. class GL_EXPORT GLContextEGL : public GLContextReal {
  17. public:
  18. explicit GLContextEGL(GLShareGroup* share_group);
  19. GLContextEGL(const GLContextEGL&) = delete;
  20. GLContextEGL& operator=(const GLContextEGL&) = delete;
  21. // Implement GLContext.
  22. bool Initialize(GLSurface* compatible_surface,
  23. const GLContextAttribs& attribs) override;
  24. bool MakeCurrentImpl(GLSurface* surface) override;
  25. void ReleaseCurrent(GLSurface* surface) override;
  26. bool IsCurrent(GLSurface* surface) override;
  27. void* GetHandle() override;
  28. unsigned int CheckStickyGraphicsResetStatusImpl() override;
  29. void SetUnbindFboOnMakeCurrent() override;
  30. YUVToRGBConverter* GetYUVToRGBConverter(
  31. const gfx::ColorSpace& color_space) override;
  32. void SetVisibility(bool visibility) override;
  33. GLDisplayEGL* GetGLDisplayEGL() override;
  34. protected:
  35. ~GLContextEGL() override;
  36. private:
  37. void Destroy();
  38. void ReleaseYUVToRGBConvertersAndBackpressureFences();
  39. EGLContext context_ = nullptr;
  40. raw_ptr<GLDisplayEGL> gl_display_ = nullptr;
  41. EGLConfig config_ = nullptr;
  42. unsigned int graphics_reset_status_ = 0; // GL_NO_ERROR;
  43. bool unbind_fbo_on_makecurrent_ = false;
  44. bool lost_ = false;
  45. std::map<gfx::ColorSpace, std::unique_ptr<YUVToRGBConverter>>
  46. yuv_to_rgb_converters_;
  47. };
  48. } // namespace gl
  49. #endif // UI_GL_GL_CONTEXT_EGL_H_