diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 17:31:41 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 17:31:41 +0000 |
commit | f3993d608359e2b2942e41392aabcafbf70b791d (patch) | |
tree | c1e69072317ac19b0e83cb2cb3addc05032efa4c | |
parent | 44e8addb60056d5a41e48572bee221f2ce046634 (diff) | |
download | chromium_src-f3993d608359e2b2942e41392aabcafbf70b791d.zip chromium_src-f3993d608359e2b2942e41392aabcafbf70b791d.tar.gz chromium_src-f3993d608359e2b2942e41392aabcafbf70b791d.tar.bz2 |
Ensure real GL Api is set before making GL calls.
In particular IOSurfaceImageTransportSurface::OnMakeCurrent()
calls into GL.
BUG=248957
Review URL: https://chromiumcodereview.appspot.com/16838007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206103 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gl/gl_context_cgl.cc | 4 | ||||
-rw-r--r-- | ui/gl/gl_context_egl.cc | 4 | ||||
-rw-r--r-- | ui/gl/gl_context_glx.cc | 4 | ||||
-rw-r--r-- | ui/gl/gl_context_osmesa.cc | 4 | ||||
-rw-r--r-- | ui/gl/gl_context_wgl.cc | 4 | ||||
-rw-r--r-- | ui/gl/gl_gl_api_implementation.cc | 2 |
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() |