summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/gl/gl_context_cgl.cc4
-rw-r--r--ui/gl/gl_context_egl.cc4
-rw-r--r--ui/gl/gl_context_glx.cc4
-rw-r--r--ui/gl/gl_context_osmesa.cc4
-rw-r--r--ui/gl/gl_context_wgl.cc4
-rw-r--r--ui/gl/gl_gl_api_implementation.cc2
6 files changed, 17 insertions, 5 deletions
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc
index d826d81..0b63b4b 100644
--- a/ui/gl/gl_context_cgl.cc
+++ b/ui/gl/gl_context_cgl.cc
@@ -186,6 +186,9 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
return false;
}
+ // Set this as soon as the context is current, since we might call into GL.
+ SetRealGLApi();
+
SetCurrent(surface);
if (!InitializeExtensionBindings()) {
ReleaseCurrent(surface);
@@ -197,7 +200,6 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
return false;
}
- SetRealGLApi();
return true;
}
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
index 7354c7d..d8fc4c7 100644
--- a/ui/gl/gl_context_egl.cc
+++ b/ui/gl/gl_context_egl.cc
@@ -112,6 +112,9 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) {
return false;
}
+ // Set this as soon as the context is current, since we might call into GL.
+ SetRealGLApi();
+
SetCurrent(surface);
if (!InitializeExtensionBindings()) {
ReleaseCurrent(surface);
@@ -123,7 +126,6 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) {
return false;
}
- SetRealGLApi();
return true;
}
diff --git a/ui/gl/gl_context_glx.cc b/ui/gl/gl_context_glx.cc
index 662538b..eb4e366 100644
--- a/ui/gl/gl_context_glx.cc
+++ b/ui/gl/gl_context_glx.cc
@@ -123,6 +123,9 @@ bool GLContextGLX::MakeCurrent(GLSurface* surface) {
return false;
}
+ // Set this as soon as the context is current, since we might call into GL.
+ SetRealGLApi();
+
SetCurrent(surface);
if (!InitializeExtensionBindings()) {
ReleaseCurrent(surface);
@@ -137,7 +140,6 @@ bool GLContextGLX::MakeCurrent(GLSurface* surface) {
return false;
}
- SetRealGLApi();
return true;
}
diff --git a/ui/gl/gl_context_osmesa.cc b/ui/gl/gl_context_osmesa.cc
index 71154ec..cb71aa5 100644
--- a/ui/gl/gl_context_osmesa.cc
+++ b/ui/gl/gl_context_osmesa.cc
@@ -62,6 +62,9 @@ bool GLContextOSMesa::MakeCurrent(GLSurface* surface) {
return false;
}
+ // Set this as soon as the context is current, since we might call into GL.
+ SetRealGLApi();
+
// Row 0 is at the top.
OSMesaPixelStore(OSMESA_Y_UP, 0);
@@ -76,7 +79,6 @@ bool GLContextOSMesa::MakeCurrent(GLSurface* surface) {
return false;
}
- SetRealGLApi();
return true;
}
diff --git a/ui/gl/gl_context_wgl.cc b/ui/gl/gl_context_wgl.cc
index dba107b..8ee90dd 100644
--- a/ui/gl/gl_context_wgl.cc
+++ b/ui/gl/gl_context_wgl.cc
@@ -81,6 +81,9 @@ bool GLContextWGL::MakeCurrent(GLSurface* surface) {
return false;
}
+ // Set this as soon as the context is current, since we might call into GL.
+ SetRealGLApi();
+
SetCurrent(surface);
if (!InitializeExtensionBindings()) {
ReleaseCurrent(surface);
@@ -92,7 +95,6 @@ bool GLContextWGL::MakeCurrent(GLSurface* surface) {
return false;
}
- SetRealGLApi();
return true;
}
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc
index 9b0a89a..802d250 100644
--- a/ui/gl/gl_gl_api_implementation.cc
+++ b/ui/gl/gl_gl_api_implementation.cc
@@ -195,6 +195,8 @@ GLApi::GLApi() {
}
GLApi::~GLApi() {
+ if (GetCurrentGLApi() == this)
+ SetGLApi(NULL);
}
GLApiBase::GLApiBase()