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 "base/command_line.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "third_party/khronos/EGL/egl.h" | 12 #include "third_party/khronos/EGL/egl.h" |
12 #include "third_party/khronos/EGL/eglext.h" | 13 #include "third_party/khronos/EGL/eglext.h" |
13 #include "ui/gl/egl_util.h" | 14 #include "ui/gl/egl_util.h" |
14 #include "ui/gl/gl_bindings.h" | 15 #include "ui/gl/gl_bindings.h" |
15 #include "ui/gl/gl_surface_egl.h" | 16 #include "ui/gl/gl_surface_egl.h" |
16 | 17 |
(...skipping 14 matching lines...) Expand all Loading... |
31 config_(NULL), | 32 config_(NULL), |
32 unbind_fbo_on_makecurrent_(false), | 33 unbind_fbo_on_makecurrent_(false), |
33 swap_interval_(1) { | 34 swap_interval_(1) { |
34 } | 35 } |
35 | 36 |
36 bool GLContextEGL::Initialize( | 37 bool GLContextEGL::Initialize( |
37 GLSurface* compatible_surface, GpuPreference gpu_preference) { | 38 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
38 DCHECK(compatible_surface); | 39 DCHECK(compatible_surface); |
39 DCHECK(!context_); | 40 DCHECK(!context_); |
40 | 41 |
41 static const EGLint kContextAttributes[] = { | 42 EGLint context_client_version = 2; |
42 EGL_CONTEXT_CLIENT_VERSION, 2, | 43 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kEnableUnsafeES3APIs)) { |
| 45 context_client_version = 3; |
| 46 } |
| 47 |
| 48 const EGLint kContextAttributes[] = { |
| 49 EGL_CONTEXT_CLIENT_VERSION, context_client_version, |
43 EGL_NONE | 50 EGL_NONE |
44 }; | 51 }; |
45 static const EGLint kContextRobustnessAttributes[] = { | 52 const EGLint kContextRobustnessAttributes[] = { |
46 EGL_CONTEXT_CLIENT_VERSION, 2, | 53 EGL_CONTEXT_CLIENT_VERSION, context_client_version, |
47 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, | 54 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, |
48 EGL_LOSE_CONTEXT_ON_RESET_EXT, | 55 EGL_LOSE_CONTEXT_ON_RESET_EXT, |
49 EGL_NONE | 56 EGL_NONE |
50 }; | 57 }; |
51 | 58 |
52 display_ = compatible_surface->GetDisplay(); | 59 display_ = compatible_surface->GetDisplay(); |
53 config_ = compatible_surface->GetConfig(); | 60 config_ = compatible_surface->GetConfig(); |
54 | 61 |
55 const EGLint* context_attributes = NULL; | 62 const EGLint* context_attributes = NULL; |
56 if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) { | 63 if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 218 |
212 #if !defined(OS_ANDROID) | 219 #if !defined(OS_ANDROID) |
213 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 220 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
214 DCHECK(bytes); | 221 DCHECK(bytes); |
215 *bytes = 0; | 222 *bytes = 0; |
216 return false; | 223 return false; |
217 } | 224 } |
218 #endif | 225 #endif |
219 | 226 |
220 } // namespace gfx | 227 } // namespace gfx |
OLD | NEW |