| 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 #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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // based on GL_ARB_occlusion_query without a lot of work virtualizing | 244 // based on GL_ARB_occlusion_query without a lot of work virtualizing |
| 245 // queries. | 245 // queries. |
| 246 it = std::find(ext.begin(), ext.end(), "GL_EXT_occlusion_query_boolean"); | 246 it = std::find(ext.begin(), ext.end(), "GL_EXT_occlusion_query_boolean"); |
| 247 if (it != ext.end()) | 247 if (it != ext.end()) |
| 248 ext.erase(it); | 248 ext.erase(it); |
| 249 | 249 |
| 250 extensions_ = JoinString(ext, " "); | 250 extensions_ = JoinString(ext, " "); |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { | 253 bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { |
| 254 DCHECK_EQ(!virtual_context, !surface); |
| 255 if (!virtual_context && !surface) { |
| 256 current_context_ = NULL; |
| 257 return true; |
| 258 } |
| 259 |
| 254 bool switched_contexts = g_current_gl_context != this; | 260 bool switched_contexts = g_current_gl_context != this; |
| 255 GLSurface* current_surface = GLSurface::GetCurrent(); | 261 GLSurface* current_surface = GLSurface::GetCurrent(); |
| 256 if (switched_contexts || surface != current_surface) { | 262 if (switched_contexts || surface != current_surface) { |
| 257 if (!switched_contexts && current_surface && | 263 if (!switched_contexts && current_surface && |
| 258 virtual_context->IsCurrent(surface)) { | 264 virtual_context->IsCurrent(surface)) { |
| 259 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() | 265 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() |
| 260 // calls if the GLSurface uses the same underlying surface or renders to | 266 // calls if the GLSurface uses the same underlying surface or renders to |
| 261 // an FBO. | 267 // an FBO. |
| 262 if (!surface->OnMakeCurrent(real_context_)) { | 268 if (!surface->OnMakeCurrent(real_context_)) { |
| 263 LOG(ERROR) << "Could not make GLSurface current."; | 269 LOG(ERROR) << "Could not make GLSurface current."; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { | 306 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { |
| 301 switch (name) { | 307 switch (name) { |
| 302 case GL_EXTENSIONS: | 308 case GL_EXTENSIONS: |
| 303 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); | 309 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); |
| 304 default: | 310 default: |
| 305 return driver_->fn.glGetStringFn(name); | 311 return driver_->fn.glGetStringFn(name); |
| 306 } | 312 } |
| 307 } | 313 } |
| 308 | 314 |
| 309 } // namespace gfx | 315 } // namespace gfx |
| OLD | NEW |