Index: ui/gl/gl_gl_api_implementation.cc |
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc |
index 672f1ea47473ec8e1b1d43b922f9c0c68dda102b..d9f5f63e59146318b4e41ce295be85256d8f903c 100644 |
--- a/ui/gl/gl_gl_api_implementation.cc |
+++ b/ui/gl/gl_gl_api_implementation.cc |
@@ -112,9 +112,9 @@ void VirtualGLApi::Initialize(DriverGL* driver, GLContext* real_context) { |
bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { |
bool switched_contexts = g_current_gl_context != this; |
- GLSurface* current_surface = GLSurface::GetCurrent(); |
- if (switched_contexts || surface != current_surface) { |
- if (!switched_contexts && current_surface && |
+ bool switched_surfaces = GLSurface::GetCurrent() != surface; |
brianderson
2013/01/04 22:00:56
Note:
This comparison is almost always false beca
|
+ if (switched_contexts || switched_surfaces) { |
+ if (!switched_contexts && GLSurface::GetCurrent() && |
virtual_context->IsCurrent(surface)) { |
// MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() |
// calls if the GLSurface uses the same underlying surface or renders to |
@@ -132,7 +132,13 @@ bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { |
DCHECK(real_context_->IsCurrent(GLSurface::GetCurrent())); |
DCHECK(virtual_context->IsCurrent(surface)); |
- if (switched_contexts || virtual_context != current_context_) { |
+ // This work around restores gl state on virtual context switches |
+ // where only the surface changes. |
+ bool qualcomm_WAR_enabled = true; // TODO: Set this only when needed. |
+ bool use_qualcomm_WAR = qualcomm_WAR_enabled && switched_surfaces; |
+ |
+ if (switched_contexts || virtual_context != current_context_ || |
+ use_qualcomm_WAR) { |
// There should be no errors from the previous context leaking into the |
// new context. |
DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR)); |