| 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 19 matching lines...) Expand all Loading... |
| 30 #ifndef EGL_ANGLE_create_context_webgl_compatibility | 30 #ifndef EGL_ANGLE_create_context_webgl_compatibility |
| 31 #define EGL_ANGLE_create_context_webgl_compatibility 1 | 31 #define EGL_ANGLE_create_context_webgl_compatibility 1 |
| 32 #define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC | 32 #define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC |
| 33 #endif /* EGL_ANGLE_create_context_webgl_compatibility */ | 33 #endif /* EGL_ANGLE_create_context_webgl_compatibility */ |
| 34 | 34 |
| 35 #ifndef EGL_ANGLE_display_texture_share_group | 35 #ifndef EGL_ANGLE_display_texture_share_group |
| 36 #define EGL_ANGLE_display_texture_share_group 1 | 36 #define EGL_ANGLE_display_texture_share_group 1 |
| 37 #define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF | 37 #define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF |
| 38 #endif /* EGL_ANGLE_display_texture_share_group */ | 38 #endif /* EGL_ANGLE_display_texture_share_group */ |
| 39 | 39 |
| 40 #ifndef EGL_ANGLE_create_context_client_arrays |
| 41 #define EGL_ANGLE_create_context_client_arrays 1 |
| 42 #define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452 |
| 43 #endif /* EGL_ANGLE_create_context_client_arrays */ |
| 44 |
| 40 using ui::GetLastEGLErrorString; | 45 using ui::GetLastEGLErrorString; |
| 41 | 46 |
| 42 namespace gl { | 47 namespace gl { |
| 43 | 48 |
| 44 GLContextEGL::GLContextEGL(GLShareGroup* share_group) | 49 GLContextEGL::GLContextEGL(GLShareGroup* share_group) |
| 45 : GLContextReal(share_group), | 50 : GLContextReal(share_group), |
| 46 context_(nullptr), | 51 context_(nullptr), |
| 47 display_(nullptr), | 52 display_(nullptr), |
| 48 config_(nullptr), | 53 config_(nullptr), |
| 49 unbind_fbo_on_makecurrent_(false), | 54 unbind_fbo_on_makecurrent_(false), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 136 } |
| 132 | 137 |
| 133 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_display_texture_share_group")) { | 138 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_display_texture_share_group")) { |
| 134 context_attributes.push_back(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE); | 139 context_attributes.push_back(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE); |
| 135 context_attributes.push_back( | 140 context_attributes.push_back( |
| 136 attribs.global_texture_share_group ? EGL_TRUE : EGL_FALSE); | 141 attribs.global_texture_share_group ? EGL_TRUE : EGL_FALSE); |
| 137 } else { | 142 } else { |
| 138 DCHECK(!attribs.global_texture_share_group); | 143 DCHECK(!attribs.global_texture_share_group); |
| 139 } | 144 } |
| 140 | 145 |
| 146 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_create_context_client_arrays")) { |
| 147 // Disable client arrays if the context supports it |
| 148 context_attributes.push_back(EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE); |
| 149 context_attributes.push_back(EGL_FALSE); |
| 150 } |
| 151 |
| 141 // Append final EGL_NONE to signal the context attributes are finished | 152 // Append final EGL_NONE to signal the context attributes are finished |
| 142 context_attributes.push_back(EGL_NONE); | 153 context_attributes.push_back(EGL_NONE); |
| 143 context_attributes.push_back(EGL_NONE); | 154 context_attributes.push_back(EGL_NONE); |
| 144 | 155 |
| 145 context_ = eglCreateContext( | 156 context_ = eglCreateContext( |
| 146 display_, config_, share_group() ? share_group()->GetHandle() : nullptr, | 157 display_, config_, share_group() ? share_group()->GetHandle() : nullptr, |
| 147 context_attributes.data()); | 158 context_attributes.data()); |
| 148 | 159 |
| 149 if (!context_) { | 160 if (!context_) { |
| 150 LOG(ERROR) << "eglCreateContext failed with error " | 161 LOG(ERROR) << "eglCreateContext failed with error " |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 288 |
| 278 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { | 289 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { |
| 279 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); | 290 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); |
| 280 } | 291 } |
| 281 | 292 |
| 282 GLContextEGL::~GLContextEGL() { | 293 GLContextEGL::~GLContextEGL() { |
| 283 Destroy(); | 294 Destroy(); |
| 284 } | 295 } |
| 285 | 296 |
| 286 } // namespace gl | 297 } // namespace gl |
| OLD | NEW |