gl_glx_api_implementation.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_GLX_API_IMPLEMENTATION_H_
  5. #define UI_GL_GL_GLX_API_IMPLEMENTATION_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/memory/raw_ptr.h"
  9. #include "gl_bindings.h"
  10. #include "ui/gl/gl_export.h"
  11. namespace gl {
  12. struct GLVersionInfo;
  13. struct GLWindowSystemBindingInfo;
  14. GL_EXPORT void InitializeStaticGLBindingsGLX();
  15. GL_EXPORT void ClearBindingsGLX();
  16. GL_EXPORT bool GetGLWindowSystemBindingInfoGLX(const GLVersionInfo& gl_info,
  17. GLWindowSystemBindingInfo* info);
  18. GL_EXPORT void SetDisabledExtensionsGLX(const std::string& disabled_extensions);
  19. GL_EXPORT bool InitializeExtensionSettingsOneOffGLX();
  20. class GL_EXPORT GLXApiBase : public GLXApi {
  21. public:
  22. // Include the auto-generated part of this class. We split this because
  23. // it means we can easily edit the non-auto generated parts right here in
  24. // this file instead of having to edit some template or the code generator.
  25. #include "gl_bindings_api_autogen_glx.h"
  26. protected:
  27. GLXApiBase();
  28. ~GLXApiBase() override;
  29. void InitializeBase(DriverGLX* driver);
  30. raw_ptr<DriverGLX> driver_;
  31. };
  32. class GL_EXPORT RealGLXApi : public GLXApiBase {
  33. public:
  34. RealGLXApi();
  35. ~RealGLXApi() override;
  36. void Initialize(DriverGLX* driver);
  37. void SetDisabledExtensions(const std::string& disabled_extensions) override;
  38. const char* glXQueryExtensionsStringFn(Display* dpy, int screen) override;
  39. private:
  40. std::vector<std::string> disabled_exts_;
  41. std::string filtered_exts_;
  42. };
  43. // Logs debug information for every GLX call.
  44. class GL_EXPORT LogGLXApi : public GLXApi {
  45. public:
  46. LogGLXApi(GLXApi* glx_api);
  47. ~LogGLXApi() override;
  48. void SetDisabledExtensions(const std::string& disabled_extensions) override;
  49. // Include the auto-generated part of this class. We split this because
  50. // it means we can easily edit the non-auto generated parts right here in
  51. // this file instead of having to edit some template or the code generator.
  52. #include "gl_bindings_api_autogen_glx.h"
  53. private:
  54. raw_ptr<GLXApi> glx_api_;
  55. };
  56. // Inserts a TRACE for every GLX call.
  57. class GL_EXPORT TraceGLXApi : public GLXApi {
  58. public:
  59. TraceGLXApi(GLXApi* glx_api) : glx_api_(glx_api) { }
  60. ~TraceGLXApi() override;
  61. void SetDisabledExtensions(const std::string& disabled_extensions) override;
  62. // Include the auto-generated part of this class. We split this because
  63. // it means we can easily edit the non-auto generated parts right here in
  64. // this file instead of having to edit some template or the code generator.
  65. #include "gl_bindings_api_autogen_glx.h"
  66. private:
  67. raw_ptr<GLXApi> glx_api_;
  68. };
  69. } // namespace gl
  70. #endif // UI_GL_GL_GLX_API_IMPLEMENTATION_H_