gl_context_glx.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_GLX_H_
  5. #define UI_GL_GL_CONTEXT_GLX_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "ui/gfx/x/connection.h"
  8. #include "ui/gl/gl_context.h"
  9. #include "ui/gl/gl_export.h"
  10. namespace gl {
  11. class GLSurface;
  12. // Encapsulates a GLX OpenGL context.
  13. class GL_EXPORT GLContextGLX : public GLContextReal {
  14. public:
  15. explicit GLContextGLX(GLShareGroup* share_group);
  16. GLContextGLX(const GLContextGLX&) = delete;
  17. GLContextGLX& operator=(const GLContextGLX&) = delete;
  18. // Implement GLContext.
  19. bool Initialize(GLSurface* compatible_surface,
  20. const GLContextAttribs& attribs) override;
  21. bool MakeCurrentImpl(GLSurface* surface) override;
  22. void ReleaseCurrent(GLSurface* surface) override;
  23. bool IsCurrent(GLSurface* surface) override;
  24. void* GetHandle() override;
  25. unsigned int CheckStickyGraphicsResetStatusImpl() override;
  26. protected:
  27. ~GLContextGLX() override;
  28. private:
  29. void Destroy();
  30. raw_ptr<void> context_ = nullptr;
  31. raw_ptr<x11::Connection> connection_ = nullptr;
  32. unsigned int graphics_reset_status_ = 0; // GL_NO_ERROR
  33. };
  34. } // namespace gl
  35. #endif // UI_GL_GL_CONTEXT_GLX_H_