| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GL_GL_CONTEXT_H_ | 5 #ifndef UI_GL_GL_CONTEXT_H_ |
| 6 #define UI_GL_GL_CONTEXT_H_ | 6 #define UI_GL_GL_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/synchronization/cancellation_flag.h" | 15 #include "base/synchronization/cancellation_flag.h" |
| 16 #include "ui/gl/gl_export.h" | 16 #include "ui/gl/gl_export.h" |
| 17 #include "ui/gl/gl_share_group.h" | 17 #include "ui/gl/gl_share_group.h" |
| 18 #include "ui/gl/gl_state_restorer.h" | 18 #include "ui/gl/gl_state_restorer.h" |
| 19 #include "ui/gl/gl_workarounds.h" |
| 19 #include "ui/gl/gpu_preference.h" | 20 #include "ui/gl/gpu_preference.h" |
| 20 | 21 |
| 21 namespace gl { | 22 namespace gl { |
| 22 class YUVToRGBConverter; | 23 class YUVToRGBConverter; |
| 23 } // namespace gl | 24 } // namespace gl |
| 24 | 25 |
| 25 namespace gpu { | 26 namespace gpu { |
| 26 class GLContextVirtual; | 27 class GLContextVirtual; |
| 27 } // namespace gpu | 28 } // namespace gpu |
| 28 | 29 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Returns true if this context and surface is current. Pass a null surface | 90 // Returns true if this context and surface is current. Pass a null surface |
| 90 // if the current surface is not important. | 91 // if the current surface is not important. |
| 91 virtual bool IsCurrent(GLSurface* surface) = 0; | 92 virtual bool IsCurrent(GLSurface* surface) = 0; |
| 92 | 93 |
| 93 // Get the underlying platform specific GL context "handle". | 94 // Get the underlying platform specific GL context "handle". |
| 94 virtual void* GetHandle() = 0; | 95 virtual void* GetHandle() = 0; |
| 95 | 96 |
| 96 // Creates a GPUTimingClient class which abstracts various GPU Timing exts. | 97 // Creates a GPUTimingClient class which abstracts various GPU Timing exts. |
| 97 virtual scoped_refptr<GPUTimingClient> CreateGPUTimingClient() = 0; | 98 virtual scoped_refptr<GPUTimingClient> CreateGPUTimingClient() = 0; |
| 98 | 99 |
| 100 // Set the GL workarounds. |
| 101 void SetGLWorkarounds(const GLWorkarounds& workarounds); |
| 102 |
| 99 // Gets the GLStateRestorer for the context. | 103 // Gets the GLStateRestorer for the context. |
| 100 GLStateRestorer* GetGLStateRestorer(); | 104 GLStateRestorer* GetGLStateRestorer(); |
| 101 | 105 |
| 102 // Sets the GLStateRestorer for the context (takes ownership). | 106 // Sets the GLStateRestorer for the context (takes ownership). |
| 103 void SetGLStateRestorer(GLStateRestorer* state_restorer); | 107 void SetGLStateRestorer(GLStateRestorer* state_restorer); |
| 104 | 108 |
| 105 // Set swap interval. This context must be current. | 109 // Set swap interval. This context must be current. |
| 106 void SetSwapInterval(int interval); | 110 void SetSwapInterval(int interval); |
| 107 | 111 |
| 108 // Forces the swap interval to zero (no vsync) regardless of any future values | 112 // Forces the swap interval to zero (no vsync) regardless of any future values |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 virtual void OnSetSwapInterval(int interval) = 0; | 219 virtual void OnSetSwapInterval(int interval) = 0; |
| 216 | 220 |
| 217 private: | 221 private: |
| 218 friend class base::RefCounted<GLContext>; | 222 friend class base::RefCounted<GLContext>; |
| 219 | 223 |
| 220 // For GetRealCurrent. | 224 // For GetRealCurrent. |
| 221 friend class gpu::GLContextVirtual; | 225 friend class gpu::GLContextVirtual; |
| 222 | 226 |
| 223 std::unique_ptr<GLVersionInfo> GenerateGLVersionInfo(); | 227 std::unique_ptr<GLVersionInfo> GenerateGLVersionInfo(); |
| 224 | 228 |
| 229 GLWorkarounds gl_workarounds_; |
| 230 |
| 225 bool static_bindings_initialized_ = false; | 231 bool static_bindings_initialized_ = false; |
| 226 bool dynamic_bindings_initialized_ = false; | 232 bool dynamic_bindings_initialized_ = false; |
| 227 std::unique_ptr<DriverGL> driver_gl_; | 233 std::unique_ptr<DriverGL> driver_gl_; |
| 228 std::unique_ptr<GLApi> gl_api_; | 234 std::unique_ptr<GLApi> gl_api_; |
| 229 std::unique_ptr<TraceGLApi> trace_gl_api_; | 235 std::unique_ptr<TraceGLApi> trace_gl_api_; |
| 230 std::unique_ptr<DebugGLApi> debug_gl_api_; | 236 std::unique_ptr<DebugGLApi> debug_gl_api_; |
| 231 std::unique_ptr<CurrentGL> current_gl_; | 237 std::unique_ptr<CurrentGL> current_gl_; |
| 232 | 238 |
| 233 // Copy of the real API (if one was created) for dynamic initialization | 239 // Copy of the real API (if one was created) for dynamic initialization |
| 234 RealGLApi* real_gl_api_ = nullptr; | 240 RealGLApi* real_gl_api_ = nullptr; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 265 // scoped_refptr containing the initialized GLContext or nullptr if | 271 // scoped_refptr containing the initialized GLContext or nullptr if |
| 266 // initialization fails. | 272 // initialization fails. |
| 267 GL_EXPORT scoped_refptr<GLContext> InitializeGLContext( | 273 GL_EXPORT scoped_refptr<GLContext> InitializeGLContext( |
| 268 scoped_refptr<GLContext> context, | 274 scoped_refptr<GLContext> context, |
| 269 GLSurface* compatible_surface, | 275 GLSurface* compatible_surface, |
| 270 const GLContextAttribs& attribs); | 276 const GLContextAttribs& attribs); |
| 271 | 277 |
| 272 } // namespace gl | 278 } // namespace gl |
| 273 | 279 |
| 274 #endif // UI_GL_GL_CONTEXT_H_ | 280 #endif // UI_GL_GL_CONTEXT_H_ |
| OLD | NEW |