| Index: ui/gl/gl_context_egl.cc
|
| diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
|
| index 1ac7d017dde589d071114432decbee55a72919ae..b1ea4e6a77040716cc441e2287edb1267613fd76 100644
|
| --- a/ui/gl/gl_context_egl.cc
|
| +++ b/ui/gl/gl_context_egl.cc
|
| @@ -22,16 +22,6 @@
|
| }
|
| #endif
|
|
|
| -#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
|
| -#define EGL_CHROMIUM_create_context_bind_generates_resource 1
|
| -#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD
|
| -#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
|
| -
|
| -#ifndef EGL_ANGLE_create_context_webgl_compatibility
|
| -#define EGL_ANGLE_create_context_webgl_compatibility 1
|
| -#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC
|
| -#endif /* EGL_ANGLE_create_context_webgl_compatibility */
|
| -
|
| using ui::GetLastEGLErrorString;
|
|
|
| namespace gl {
|
| @@ -45,8 +35,8 @@
|
| swap_interval_(1) {
|
| }
|
|
|
| -bool GLContextEGL::Initialize(GLSurface* compatible_surface,
|
| - const GLContextAttribs& attribs) {
|
| +bool GLContextEGL::Initialize(
|
| + GLSurface* compatible_surface, GpuPreference gpu_preference) {
|
| DCHECK(compatible_surface);
|
| DCHECK(!context_);
|
|
|
| @@ -68,19 +58,26 @@
|
| context_client_version = 3;
|
| }
|
|
|
| - std::vector<EGLint> context_attributes;
|
| - context_attributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
|
| - context_attributes.push_back(context_client_version);
|
| -
|
| + const EGLint kContextAttributes[] = {
|
| + EGL_CONTEXT_CLIENT_VERSION, context_client_version,
|
| + EGL_NONE
|
| + };
|
| + const EGLint kContextRobustnessAttributes[] = {
|
| + EGL_CONTEXT_CLIENT_VERSION, context_client_version,
|
| + EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
|
| + EGL_LOSE_CONTEXT_ON_RESET_EXT,
|
| + EGL_NONE
|
| + };
|
| +
|
| + const EGLint* context_attributes = nullptr;
|
| if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) {
|
| DVLOG(1) << "EGL_EXT_create_context_robustness supported.";
|
| + context_attributes = kContextRobustnessAttributes;
|
| } else {
|
| // At some point we should require the presence of the robustness
|
| // extension and remove this code path.
|
| DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported.";
|
| - context_attributes.push_back(
|
| - EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT);
|
| - context_attributes.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
|
| + context_attributes = kContextAttributes;
|
| }
|
|
|
| if (!eglBindAPI(EGL_OPENGL_ES_API)) {
|
| @@ -89,29 +86,11 @@
|
| return false;
|
| }
|
|
|
| - if (GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported()) {
|
| - context_attributes.push_back(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM);
|
| - context_attributes.push_back(attribs.bind_generates_resource ? EGL_TRUE
|
| - : EGL_FALSE);
|
| - } else {
|
| - DCHECK(attribs.bind_generates_resource);
|
| - }
|
| -
|
| - if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) {
|
| - context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
|
| - context_attributes.push_back(
|
| - attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE);
|
| - } else {
|
| - DCHECK(!attribs.webgl_compatibility_context);
|
| - }
|
| -
|
| - // Append final EGL_NONE to signal the context attributes are finished
|
| - context_attributes.push_back(EGL_NONE);
|
| - context_attributes.push_back(EGL_NONE);
|
| -
|
| context_ = eglCreateContext(
|
| - display_, config_, share_group() ? share_group()->GetHandle() : nullptr,
|
| - context_attributes.data());
|
| + display_,
|
| + config_,
|
| + share_group() ? share_group()->GetHandle() : nullptr,
|
| + context_attributes);
|
|
|
| if (!context_) {
|
| LOG(ERROR) << "eglCreateContext failed with error "
|
|
|