 Chromium Code Reviews
 Chromium Code Reviews Issue 2934733002:
  Workaround for Intel 6xxx clear to 0/1 bug  (Closed)
    
  
    Issue 2934733002:
  Workaround for Intel 6xxx clear to 0/1 bug  (Closed) 
  | 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> | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 struct GLContextAttribs { | 61 struct GLContextAttribs { | 
| 62 GpuPreference gpu_preference = PreferIntegratedGpu; | 62 GpuPreference gpu_preference = PreferIntegratedGpu; | 
| 63 bool bind_generates_resource = true; | 63 bool bind_generates_resource = true; | 
| 64 bool webgl_compatibility_context = false; | 64 bool webgl_compatibility_context = false; | 
| 65 bool global_texture_share_group = false; | 65 bool global_texture_share_group = false; | 
| 66 int client_major_es_version = 3; | 66 int client_major_es_version = 3; | 
| 67 int client_minor_es_version = 0; | 67 int client_minor_es_version = 0; | 
| 68 ContextPriority context_priority = ContextPriorityMedium; | 68 ContextPriority context_priority = ContextPriorityMedium; | 
| 69 }; | 69 }; | 
| 70 | 70 | 
| 71 struct GLWorkarounds { | |
| 72 // glClearColor does not always work on Intel 6xxx Mac drivers. See | |
| 73 // crbug.com/710443. | |
| 74 bool clear_to_zero_or_one_broken = false; | |
| 75 }; | |
| 76 | |
| 71 // Encapsulates an OpenGL context, hiding platform specific management. | 77 // Encapsulates an OpenGL context, hiding platform specific management. | 
| 72 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { | 78 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { | 
| 73 public: | 79 public: | 
| 74 explicit GLContext(GLShareGroup* share_group); | 80 explicit GLContext(GLShareGroup* share_group); | 
| 75 | 81 | 
| 82 // Set the GL workarounds. | |
| 83 static void SetGLWorkarounds(const GLWorkarounds& workarounds); | |
| 84 // Get the GL workarounds. | |
| 85 static GLWorkarounds GetGLWorkarounds(); | |
| 86 | |
| 76 // Initializes the GL context to be compatible with the given surface. The GL | 87 // Initializes the GL context to be compatible with the given surface. The GL | 
| 77 // context can be made with other surface's of the same type. The compatible | 88 // context can be made with other surface's of the same type. The compatible | 
| 78 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It | 89 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It | 
| 79 // should be specific for all platforms though. | 90 // should be specific for all platforms though. | 
| 80 virtual bool Initialize(GLSurface* compatible_surface, | 91 virtual bool Initialize(GLSurface* compatible_surface, | 
| 81 const GLContextAttribs& attribs) = 0; | 92 const GLContextAttribs& attribs) = 0; | 
| 82 | 93 | 
| 83 // Makes the GL context and a surface current on the current thread. | 94 // Makes the GL context and a surface current on the current thread. | 
| 84 virtual bool MakeCurrent(GLSurface* surface) = 0; | 95 virtual bool MakeCurrent(GLSurface* surface) = 0; | 
| 85 | 96 | 
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 virtual void OnSetSwapInterval(int interval) = 0; | 226 virtual void OnSetSwapInterval(int interval) = 0; | 
| 216 | 227 | 
| 217 private: | 228 private: | 
| 218 friend class base::RefCounted<GLContext>; | 229 friend class base::RefCounted<GLContext>; | 
| 219 | 230 | 
| 220 // For GetRealCurrent. | 231 // For GetRealCurrent. | 
| 221 friend class gpu::GLContextVirtual; | 232 friend class gpu::GLContextVirtual; | 
| 222 | 233 | 
| 223 std::unique_ptr<GLVersionInfo> GenerateGLVersionInfo(); | 234 std::unique_ptr<GLVersionInfo> GenerateGLVersionInfo(); | 
| 224 | 235 | 
| 236 static GLWorkarounds gl_workarounds_; | |
| 
Zhenyao Mo
2017/06/21 16:52:05
Again, sorry for not being clear.  I think this ne
 
jiajia.qin
2017/06/22 11:18:58
OK. I have modified it to a non-static member. But
 | |
| 237 | |
| 225 bool static_bindings_initialized_ = false; | 238 bool static_bindings_initialized_ = false; | 
| 226 bool dynamic_bindings_initialized_ = false; | 239 bool dynamic_bindings_initialized_ = false; | 
| 227 std::unique_ptr<DriverGL> driver_gl_; | 240 std::unique_ptr<DriverGL> driver_gl_; | 
| 228 std::unique_ptr<GLApi> gl_api_; | 241 std::unique_ptr<GLApi> gl_api_; | 
| 229 std::unique_ptr<TraceGLApi> trace_gl_api_; | 242 std::unique_ptr<TraceGLApi> trace_gl_api_; | 
| 230 std::unique_ptr<DebugGLApi> debug_gl_api_; | 243 std::unique_ptr<DebugGLApi> debug_gl_api_; | 
| 231 std::unique_ptr<CurrentGL> current_gl_; | 244 std::unique_ptr<CurrentGL> current_gl_; | 
| 232 | 245 | 
| 233 // Copy of the real API (if one was created) for dynamic initialization | 246 // Copy of the real API (if one was created) for dynamic initialization | 
| 234 RealGLApi* real_gl_api_ = nullptr; | 247 RealGLApi* real_gl_api_ = nullptr; | 
| (...skipping 30 matching lines...) Expand all Loading... | |
| 265 // scoped_refptr containing the initialized GLContext or nullptr if | 278 // scoped_refptr containing the initialized GLContext or nullptr if | 
| 266 // initialization fails. | 279 // initialization fails. | 
| 267 GL_EXPORT scoped_refptr<GLContext> InitializeGLContext( | 280 GL_EXPORT scoped_refptr<GLContext> InitializeGLContext( | 
| 268 scoped_refptr<GLContext> context, | 281 scoped_refptr<GLContext> context, | 
| 269 GLSurface* compatible_surface, | 282 GLSurface* compatible_surface, | 
| 270 const GLContextAttribs& attribs); | 283 const GLContextAttribs& attribs); | 
| 271 | 284 | 
| 272 } // namespace gl | 285 } // namespace gl | 
| 273 | 286 | 
| 274 #endif // UI_GL_GL_CONTEXT_H_ | 287 #endif // UI_GL_GL_CONTEXT_H_ | 
| OLD | NEW |