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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 | 45 |
46 EGLint config_renderable_type = 0; | 46 EGLint config_renderable_type = 0; |
47 if (!eglGetConfigAttrib(display_, config_, EGL_RENDERABLE_TYPE, | 47 if (!eglGetConfigAttrib(display_, config_, EGL_RENDERABLE_TYPE, |
48 &config_renderable_type)) { | 48 &config_renderable_type)) { |
49 LOG(ERROR) << "eglGetConfigAttrib failed with error " | 49 LOG(ERROR) << "eglGetConfigAttrib failed with error " |
50 << GetLastEGLErrorString(); | 50 << GetLastEGLErrorString(); |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 EGLint context_client_version = 2; | 54 EGLint context_client_version = 2; |
55 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 55 if ((config_renderable_type & EGL_OPENGL_ES3_BIT) != 0 && |
56 switches::kEnableUnsafeES3APIs) && | 56 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
57 (config_renderable_type & EGL_OPENGL_ES3_BIT) != 0) { | 57 switches::kDisableES3ANGLE)) { |
Ken Russell (switch to Gerrit)
2016/09/21 21:18:32
Thinking about this more, perhaps the switch and d
Zhenyao Mo
2016/09/21 21:39:06
I suggest use "disable_es3_gl_context" instead, be
| |
58 context_client_version = 3; | 58 context_client_version = 3; |
59 } | 59 } |
60 | 60 |
61 const EGLint kContextAttributes[] = { | 61 const EGLint kContextAttributes[] = { |
62 EGL_CONTEXT_CLIENT_VERSION, context_client_version, | 62 EGL_CONTEXT_CLIENT_VERSION, context_client_version, |
63 EGL_NONE | 63 EGL_NONE |
64 }; | 64 }; |
65 const EGLint kContextRobustnessAttributes[] = { | 65 const EGLint kContextRobustnessAttributes[] = { |
66 EGL_CONTEXT_CLIENT_VERSION, context_client_version, | 66 EGL_CONTEXT_CLIENT_VERSION, context_client_version, |
67 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, | 67 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, |
(...skipping 11 matching lines...) Expand all Loading... | |
79 DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported."; | 79 DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported."; |
80 context_attributes = kContextAttributes; | 80 context_attributes = kContextAttributes; |
81 } | 81 } |
82 | 82 |
83 if (!eglBindAPI(EGL_OPENGL_ES_API)) { | 83 if (!eglBindAPI(EGL_OPENGL_ES_API)) { |
84 LOG(ERROR) << "eglBindApi failed with error " | 84 LOG(ERROR) << "eglBindApi failed with error " |
85 << GetLastEGLErrorString(); | 85 << GetLastEGLErrorString(); |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 | |
90 context_ = eglCreateContext( | 89 context_ = eglCreateContext( |
91 display_, | 90 display_, |
92 config_, | 91 config_, |
93 share_group() ? share_group()->GetHandle() : nullptr, | 92 share_group() ? share_group()->GetHandle() : nullptr, |
94 context_attributes); | 93 context_attributes); |
95 | 94 |
96 if (!context_) { | 95 if (!context_) { |
97 LOG(ERROR) << "eglCreateContext failed with error " | 96 LOG(ERROR) << "eglCreateContext failed with error " |
98 << GetLastEGLErrorString(); | 97 << GetLastEGLErrorString(); |
99 return false; | 98 return false; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 223 |
225 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { | 224 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { |
226 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); | 225 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); |
227 } | 226 } |
228 | 227 |
229 GLContextEGL::~GLContextEGL() { | 228 GLContextEGL::~GLContextEGL() { |
230 Destroy(); | 229 Destroy(); |
231 } | 230 } |
232 | 231 |
233 } // namespace gl | 232 } // namespace gl |
OLD | NEW |