Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ui/gl/gl_context.cc

Issue 2934733002: Workaround for Intel 6xxx clear to 0/1 bug (Closed)
Patch Set: rebase and move workarounds to gl_context Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/gl/gl_context.h" 5 #include "ui/gl/gl_context.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/threading/thread_local.h" 16 #include "base/threading/thread_local.h"
17 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
18 #include "ui/gl/gl_gl_api_implementation.h" 18 #include "ui/gl/gl_gl_api_implementation.h"
19 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
20 #include "ui/gl/gl_surface.h" 20 #include "ui/gl/gl_surface.h"
21 #include "ui/gl/gl_switches.h" 21 #include "ui/gl/gl_switches.h"
22 #include "ui/gl/gl_version_info.h" 22 #include "ui/gl/gl_version_info.h"
23 #include "ui/gl/gpu_timing.h" 23 #include "ui/gl/gpu_timing.h"
24 24
25 namespace gl { 25 namespace gl {
26 26
27 namespace { 27 namespace {
28
28 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky 29 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky
29 current_context_ = LAZY_INSTANCE_INITIALIZER; 30 current_context_ = LAZY_INSTANCE_INITIALIZER;
30 31
31 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky 32 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky
32 current_real_context_ = LAZY_INSTANCE_INITIALIZER; 33 current_real_context_ = LAZY_INSTANCE_INITIALIZER;
34
35 GLWorkarounds gl_workarounds;
Zhenyao Mo 2017/06/20 21:34:17 Sorry. What I mean is the gl_workarounds should be
jiajia.qin 2017/06/21 02:47:22 Done.
36
33 } // namespace 37 } // namespace
34 38
39 void SetGLWorkarounds(const GLWorkarounds& workarounds) {
40 gl_workarounds = workarounds;
41 }
42
43 GLWorkarounds GetGLWorkarounds() {
44 return gl_workarounds;
45 }
46
35 GLContext::ScopedReleaseCurrent::ScopedReleaseCurrent() : canceled_(false) {} 47 GLContext::ScopedReleaseCurrent::ScopedReleaseCurrent() : canceled_(false) {}
36 48
37 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { 49 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() {
38 if (!canceled_ && GetCurrent()) { 50 if (!canceled_ && GetCurrent()) {
39 GetCurrent()->ReleaseCurrent(nullptr); 51 GetCurrent()->ReleaseCurrent(nullptr);
40 } 52 }
41 } 53 }
42 54
43 void GLContext::ScopedReleaseCurrent::Cancel() { 55 void GLContext::ScopedReleaseCurrent::Cancel() {
44 canceled_ = true; 56 canceled_ = true;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 351
340 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, 352 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context,
341 GLSurface* compatible_surface, 353 GLSurface* compatible_surface,
342 const GLContextAttribs& attribs) { 354 const GLContextAttribs& attribs) {
343 if (!context->Initialize(compatible_surface, attribs)) 355 if (!context->Initialize(compatible_surface, attribs))
344 return nullptr; 356 return nullptr;
345 return context; 357 return context;
346 } 358 }
347 359
348 } // namespace gl 360 } // namespace gl
OLDNEW
« ui/gl/gl_context.h ('K') | « ui/gl/gl_context.h ('k') | ui/gl/gl_gl_api_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698