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_surface_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
6 | 6 |
7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 // From ANGLE's egl/eglext.h. | 41 // From ANGLE's egl/eglext.h. |
42 #if !defined(EGL_PLATFORM_ANGLE_ANGLE) | 42 #if !defined(EGL_PLATFORM_ANGLE_ANGLE) |
43 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201 | 43 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201 |
44 #endif | 44 #endif |
45 #if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE) | 45 #if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE) |
46 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 | 46 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 |
47 #endif | 47 #endif |
48 #if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE) | 48 #if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) |
49 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206 | 49 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207 |
| 50 #endif |
| 51 #if !defined(EGL_PLATFORM_ANGLE_USE_WARP_ANGLE) |
| 52 #define EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208 |
50 #endif | 53 #endif |
51 #endif // defined(OS_WIN) | 54 #endif // defined(OS_WIN) |
52 | 55 |
53 using ui::GetLastEGLErrorString; | 56 using ui::GetLastEGLErrorString; |
54 | 57 |
55 namespace gfx { | 58 namespace gfx { |
56 | 59 |
57 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; | 60 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; |
58 | 61 |
59 namespace { | 62 namespace { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 248 } |
246 | 249 |
247 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() { | 250 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() { |
248 return g_egl_surfaceless_context_supported; | 251 return g_egl_surfaceless_context_supported; |
249 } | 252 } |
250 | 253 |
251 GLSurfaceEGL::~GLSurfaceEGL() {} | 254 GLSurfaceEGL::~GLSurfaceEGL() {} |
252 | 255 |
253 #if defined(OS_WIN) | 256 #if defined(OS_WIN) |
254 static const EGLint kDisplayAttribsWarp[] { | 257 static const EGLint kDisplayAttribsWarp[] { |
255 EGL_PLATFORM_ANGLE_TYPE_ANGLE, | 258 EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, |
256 EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE, | 259 EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_TRUE, |
257 EGL_NONE | 260 EGL_NONE |
258 }; | 261 }; |
259 | 262 |
260 // static | 263 // static |
261 EGLDisplay GLSurfaceEGL::GetPlatformDisplay( | 264 EGLDisplay GLSurfaceEGL::GetPlatformDisplay( |
262 EGLNativeDisplayType native_display) { | 265 EGLNativeDisplayType native_display) { |
263 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) { | 266 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) { |
264 // Check for availability of WARP via ANGLE extension. | 267 // Check for availability of WARP via ANGLE extension. |
265 bool supports_warp = false; | 268 bool supports_warp = false; |
266 const char* no_display_extensions = eglQueryString(EGL_NO_DISPLAY, | 269 const char* no_display_extensions = eglQueryString(EGL_NO_DISPLAY, |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 } | 741 } |
739 | 742 |
740 void* SurfacelessEGL::GetShareHandle() { | 743 void* SurfacelessEGL::GetShareHandle() { |
741 return NULL; | 744 return NULL; |
742 } | 745 } |
743 | 746 |
744 SurfacelessEGL::~SurfacelessEGL() { | 747 SurfacelessEGL::~SurfacelessEGL() { |
745 } | 748 } |
746 | 749 |
747 } // namespace gfx | 750 } // namespace gfx |
OLD | NEW |