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_context_egl.h" | 5 #include "ui/gl/gl_context_egl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bool GLContextEGL::MakeCurrent(GLSurface* surface) { | 107 bool GLContextEGL::MakeCurrent(GLSurface* surface) { |
108 DCHECK(context_); | 108 DCHECK(context_); |
109 if (IsCurrent(surface)) | 109 if (IsCurrent(surface)) |
110 return true; | 110 return true; |
111 | 111 |
112 ScopedReleaseCurrent release_current; | 112 ScopedReleaseCurrent release_current; |
113 TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent", | 113 TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent", |
114 "context", context_, | 114 "context", context_, |
115 "surface", surface); | 115 "surface", surface); |
116 | 116 |
117 if (unbind_fbo_on_makecurrent_ && | 117 if (unbind_fbo_on_makecurrent_ && GetCurrent()) { |
118 eglGetCurrentContext() != EGL_NO_CONTEXT) { | |
119 glBindFramebufferEXT(GL_FRAMEBUFFER, 0); | 118 glBindFramebufferEXT(GL_FRAMEBUFFER, 0); |
120 } | 119 } |
121 | 120 |
122 if (!eglMakeCurrent(display_, | 121 if (!eglMakeCurrent(display_, |
123 surface->GetHandle(), | 122 surface->GetHandle(), |
124 surface->GetHandle(), | 123 surface->GetHandle(), |
125 context_)) { | 124 context_)) { |
126 DVLOG(1) << "eglMakeCurrent failed with error " | 125 DVLOG(1) << "eglMakeCurrent failed with error " |
127 << GetLastEGLErrorString(); | 126 << GetLastEGLErrorString(); |
128 return false; | 127 return false; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 215 |
217 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { | 216 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { |
218 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); | 217 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); |
219 } | 218 } |
220 | 219 |
221 GLContextEGL::~GLContextEGL() { | 220 GLContextEGL::~GLContextEGL() { |
222 Destroy(); | 221 Destroy(); |
223 } | 222 } |
224 | 223 |
225 } // namespace gl | 224 } // namespace gl |
OLD | NEW |