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

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

Issue 14069008: GPU: Reduce MakeCurrent calls to fix Orange San Diego (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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_gl_api_implementation.h" 5 #include "ui/gl/gl_gl_api_implementation.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (switched_contexts || surface != current_surface) { 137 if (switched_contexts || surface != current_surface) {
138 if (!switched_contexts && current_surface && 138 if (!switched_contexts && current_surface &&
139 virtual_context->IsCurrent(surface)) { 139 virtual_context->IsCurrent(surface)) {
140 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() 140 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent()
141 // calls if the GLSurface uses the same underlying surface or renders to 141 // calls if the GLSurface uses the same underlying surface or renders to
142 // an FBO. 142 // an FBO.
143 if (!surface->OnMakeCurrent(real_context_)) { 143 if (!surface->OnMakeCurrent(real_context_)) {
144 LOG(ERROR) << "Could not make GLSurface current."; 144 LOG(ERROR) << "Could not make GLSurface current.";
145 return false; 145 return false;
146 } 146 }
147 } else if (!real_context_->MakeCurrent(surface)) { 147 } else {
148 return false; 148 if (!real_context_->MakeCurrent(surface))
149 return false;
149 } 150 }
150 } 151 }
151 152
152 DCHECK(GLSurface::GetCurrent()); 153 DCHECK(GLSurface::GetCurrent());
153 DCHECK(real_context_->IsCurrent(GLSurface::GetCurrent())); 154 DCHECK(real_context_->IsCurrent(GLSurface::GetCurrent()));
154 DCHECK(virtual_context->IsCurrent(surface)); 155 DCHECK(virtual_context->IsCurrent(surface));
155 156
156 if (switched_contexts || virtual_context != current_context_) { 157 if (switched_contexts || virtual_context != current_context_) {
157 // There should be no errors from the previous context leaking into the 158 // There should be no errors from the previous context leaking into the
158 // new context. 159 // new context.
(...skipping 22 matching lines...) Expand all
181 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { 182 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) {
182 switch (name) { 183 switch (name) {
183 case GL_EXTENSIONS: 184 case GL_EXTENSIONS:
184 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); 185 return reinterpret_cast<const GLubyte*>(extensions_.c_str());
185 default: 186 default:
186 return driver_->fn.glGetStringFn(name); 187 return driver_->fn.glGetStringFn(name);
187 } 188 }
188 } 189 }
189 190
190 } // namespace gfx 191 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698