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

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

Issue 16838007: Ensure real GL Api is set before making GL calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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_context_egl.h" 5 #include "ui/gl/gl_context_egl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 if (!eglMakeCurrent(display_, 106 if (!eglMakeCurrent(display_,
107 surface->GetHandle(), 107 surface->GetHandle(),
108 surface->GetHandle(), 108 surface->GetHandle(),
109 context_)) { 109 context_)) {
110 DVLOG(1) << "eglMakeCurrent failed with error " 110 DVLOG(1) << "eglMakeCurrent failed with error "
111 << GetLastEGLErrorString(); 111 << GetLastEGLErrorString();
112 return false; 112 return false;
113 } 113 }
114 114
115 // Set this as soon as the context is current, since we might call into GL.
116 SetRealGLApi();
117
115 SetCurrent(surface); 118 SetCurrent(surface);
116 if (!InitializeExtensionBindings()) { 119 if (!InitializeExtensionBindings()) {
117 ReleaseCurrent(surface); 120 ReleaseCurrent(surface);
118 return false; 121 return false;
119 } 122 }
120 123
121 if (!surface->OnMakeCurrent(this)) { 124 if (!surface->OnMakeCurrent(this)) {
122 LOG(ERROR) << "Could not make current."; 125 LOG(ERROR) << "Could not make current.";
123 return false; 126 return false;
124 } 127 }
125 128
126 SetRealGLApi();
127 return true; 129 return true;
128 } 130 }
129 131
130 void GLContextEGL::SetUnbindFboOnMakeCurrent() { 132 void GLContextEGL::SetUnbindFboOnMakeCurrent() {
131 unbind_fbo_on_makecurrent_ = true; 133 unbind_fbo_on_makecurrent_ = true;
132 } 134 }
133 135
134 void GLContextEGL::ReleaseCurrent(GLSurface* surface) { 136 void GLContextEGL::ReleaseCurrent(GLSurface* surface) {
135 if (!IsCurrent(surface)) 137 if (!IsCurrent(surface))
136 return; 138 return;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 199
198 #if !defined(OS_ANDROID) 200 #if !defined(OS_ANDROID)
199 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { 201 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) {
200 DCHECK(bytes); 202 DCHECK(bytes);
201 *bytes = 0; 203 *bytes = 0;
202 return false; 204 return false;
203 } 205 }
204 #endif 206 #endif
205 207
206 } // namespace gfx 208 } // namespace gfx
OLDNEW
« ui/gl/gl_context_cgl.cc ('K') | « ui/gl/gl_context_cgl.cc ('k') | ui/gl/gl_context_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698