| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 switches::kDisableES3GLContext)) { | 67 switches::kDisableES3GLContext)) { |
| 68 context_client_version = 3; | 68 context_client_version = 3; |
| 69 } | 69 } |
| 70 | 70 |
| 71 std::vector<EGLint> context_attributes; | 71 std::vector<EGLint> context_attributes; |
| 72 context_attributes.push_back(EGL_CONTEXT_CLIENT_VERSION); | 72 context_attributes.push_back(EGL_CONTEXT_CLIENT_VERSION); |
| 73 context_attributes.push_back(context_client_version); | 73 context_attributes.push_back(context_client_version); |
| 74 | 74 |
| 75 if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) { | 75 if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) { |
| 76 DVLOG(1) << "EGL_EXT_create_context_robustness supported."; | 76 DVLOG(1) << "EGL_EXT_create_context_robustness supported."; |
| 77 context_attributes.push_back( |
| 78 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT); |
| 79 context_attributes.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT); |
| 77 } else { | 80 } else { |
| 78 // At some point we should require the presence of the robustness | 81 // At some point we should require the presence of the robustness |
| 79 // extension and remove this code path. | 82 // extension and remove this code path. |
| 80 DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported."; | 83 DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported."; |
| 81 context_attributes.push_back( | |
| 82 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT); | |
| 83 context_attributes.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT); | |
| 84 } | 84 } |
| 85 | 85 |
| 86 if (!eglBindAPI(EGL_OPENGL_ES_API)) { | 86 if (!eglBindAPI(EGL_OPENGL_ES_API)) { |
| 87 LOG(ERROR) << "eglBindApi failed with error " | 87 LOG(ERROR) << "eglBindApi failed with error " |
| 88 << GetLastEGLErrorString(); | 88 << GetLastEGLErrorString(); |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported()) { | 92 if (GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported()) { |
| 93 context_attributes.push_back(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM); | 93 context_attributes.push_back(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { | 245 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { |
| 246 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); | 246 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 GLContextEGL::~GLContextEGL() { | 249 GLContextEGL::~GLContextEGL() { |
| 250 Destroy(); | 250 Destroy(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace gl | 253 } // namespace gl |
| OLD | NEW |