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

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

Issue 2934733002: Workaround for Intel 6xxx clear to 0/1 bug (Closed)
Patch Set: rebased, rename setGLWorkarounds to set_gl_workarounds Created 3 years, 5 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
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_gl_api_implementation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 share_group_->RemoveContext(this); 54 share_group_->RemoveContext(this);
55 if (GetCurrent() == this) { 55 if (GetCurrent() == this) {
56 SetCurrent(nullptr); 56 SetCurrent(nullptr);
57 SetCurrentGL(nullptr); 57 SetCurrentGL(nullptr);
58 } 58 }
59 } 59 }
60 60
61 GLApi* GLContext::CreateGLApi(DriverGL* driver) { 61 GLApi* GLContext::CreateGLApi(DriverGL* driver) {
62 real_gl_api_ = new RealGLApi; 62 real_gl_api_ = new RealGLApi;
63 real_gl_api_->Initialize(driver); 63 real_gl_api_->Initialize(driver);
64 real_gl_api_->set_gl_workarounds(gl_workarounds_);
64 return real_gl_api_; 65 return real_gl_api_;
65 } 66 }
66 67
67 void GLContext::SetSafeToForceGpuSwitch() { 68 void GLContext::SetSafeToForceGpuSwitch() {
68 } 69 }
69 70
70 bool GLContext::ForceGpuSwitchIfNeeded() { 71 bool GLContext::ForceGpuSwitchIfNeeded() {
71 return true; 72 return true;
72 } 73 }
73 74
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 GLSurface::SetCurrent(surface); 204 GLSurface::SetCurrent(surface);
204 // Leave the real GL api current so that unit tests work correctly. 205 // Leave the real GL api current so that unit tests work correctly.
205 // TODO(sievers): Remove this, but needs all gpu_unittest classes 206 // TODO(sievers): Remove this, but needs all gpu_unittest classes
206 // to create and make current a context. 207 // to create and make current a context.
207 if (!surface && GetGLImplementation() != kGLImplementationMockGL && 208 if (!surface && GetGLImplementation() != kGLImplementationMockGL &&
208 GetGLImplementation() != kGLImplementationStubGL) { 209 GetGLImplementation() != kGLImplementationStubGL) {
209 SetCurrentGL(nullptr); 210 SetCurrentGL(nullptr);
210 } 211 }
211 } 212 }
212 213
214 void GLContext::SetGLWorkarounds(const GLWorkarounds& workarounds) {
215 DCHECK(IsCurrent(nullptr));
216 gl_workarounds_ = workarounds;
217 if (real_gl_api_) {
218 real_gl_api_->set_gl_workarounds(gl_workarounds_);
219 }
220 }
221
213 GLStateRestorer* GLContext::GetGLStateRestorer() { 222 GLStateRestorer* GLContext::GetGLStateRestorer() {
214 return state_restorer_.get(); 223 return state_restorer_.get();
215 } 224 }
216 225
217 void GLContext::SetGLStateRestorer(GLStateRestorer* state_restorer) { 226 void GLContext::SetGLStateRestorer(GLStateRestorer* state_restorer) {
218 state_restorer_ = base::WrapUnique(state_restorer); 227 state_restorer_ = base::WrapUnique(state_restorer);
219 } 228 }
220 229
221 void GLContext::SetSwapInterval(int interval) { 230 void GLContext::SetSwapInterval(int interval) {
222 if (swap_interval_ == interval) 231 if (swap_interval_ == interval)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 348
340 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, 349 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context,
341 GLSurface* compatible_surface, 350 GLSurface* compatible_surface,
342 const GLContextAttribs& attribs) { 351 const GLContextAttribs& attribs) {
343 if (!context->Initialize(compatible_surface, attribs)) 352 if (!context->Initialize(compatible_surface, attribs))
344 return nullptr; 353 return nullptr;
345 return context; 354 return context;
346 } 355 }
347 356
348 } // namespace gl 357 } // namespace gl
OLDNEW
« no previous file with comments | « 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