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 21 matching lines...) Expand all Loading... |
32 #if defined (USE_OZONE) | 32 #if defined (USE_OZONE) |
33 #include "ui/ozone/public/surface_factory_ozone.h" | 33 #include "ui/ozone/public/surface_factory_ozone.h" |
34 #endif | 34 #endif |
35 | 35 |
36 #if !defined(EGL_FIXED_SIZE_ANGLE) | 36 #if !defined(EGL_FIXED_SIZE_ANGLE) |
37 #define EGL_FIXED_SIZE_ANGLE 0x3201 | 37 #define EGL_FIXED_SIZE_ANGLE 0x3201 |
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 |
43 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201 | 43 #ifndef EGL_ANGLE_platform_angle |
44 #endif | 44 #define EGL_ANGLE_platform_angle 1 |
45 #if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE) | 45 #define EGL_PLATFORM_ANGLE_ANGLE 0x3202 |
46 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 | 46 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 |
47 #endif | 47 #define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204 |
48 #if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) | 48 #define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205 |
49 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207 | 49 #define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206 |
50 #endif | 50 #endif /* EGL_ANGLE_platform_angle */ |
51 #if !defined(EGL_PLATFORM_ANGLE_USE_WARP_ANGLE) | 51 |
52 #define EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208 | 52 #ifndef EGL_ANGLE_platform_angle_d3d |
53 #endif | 53 #define EGL_ANGLE_platform_angle_d3d 1 |
| 54 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 |
| 55 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 |
| 56 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209 |
| 57 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A |
| 58 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B |
| 59 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C |
| 60 #endif /* EGL_ANGLE_platform_angle_d3d */ |
| 61 |
54 #endif // defined(OS_WIN) | 62 #endif // defined(OS_WIN) |
55 | 63 |
56 using ui::GetLastEGLErrorString; | 64 using ui::GetLastEGLErrorString; |
57 | 65 |
58 namespace gfx { | 66 namespace gfx { |
59 | 67 |
60 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
61 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; | 69 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; |
62 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; | 70 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; |
63 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; | 71 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 GLSurfaceEGL::~GLSurfaceEGL() { | 314 GLSurfaceEGL::~GLSurfaceEGL() { |
307 DCHECK_GT(g_num_surfaces, 0) << "Bad surface count"; | 315 DCHECK_GT(g_num_surfaces, 0) << "Bad surface count"; |
308 if (--g_num_surfaces == 0 && g_terminate_pending) { | 316 if (--g_num_surfaces == 0 && g_terminate_pending) { |
309 DeinitializeEgl(); | 317 DeinitializeEgl(); |
310 g_terminate_pending = false; | 318 g_terminate_pending = false; |
311 } | 319 } |
312 } | 320 } |
313 | 321 |
314 #if defined(OS_WIN) | 322 #if defined(OS_WIN) |
315 static const EGLint kDisplayAttribsWarp[] { | 323 static const EGLint kDisplayAttribsWarp[] { |
316 EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, | 324 EGL_PLATFORM_ANGLE_TYPE_ANGLE, |
317 EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_TRUE, | 325 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, |
| 326 |
| 327 EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, |
| 328 EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE, |
| 329 |
318 EGL_NONE | 330 EGL_NONE |
319 }; | 331 }; |
320 | 332 |
321 // static | 333 // static |
322 EGLDisplay GLSurfaceEGL::GetPlatformDisplay( | 334 EGLDisplay GLSurfaceEGL::GetPlatformDisplay( |
323 EGLNativeDisplayType native_display) { | 335 EGLNativeDisplayType native_display) { |
324 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) { | 336 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) { |
325 // Check for availability of WARP via ANGLE extension. | 337 // Check for availability of WARP via ANGLE extension. |
326 bool supports_warp = false; | 338 bool supports_warp = false; |
327 const char* no_display_extensions = eglQueryString(EGL_NO_DISPLAY, | 339 const char* no_display_extensions = eglQueryString(EGL_NO_DISPLAY, |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 822 } |
811 | 823 |
812 void* SurfacelessEGL::GetShareHandle() { | 824 void* SurfacelessEGL::GetShareHandle() { |
813 return NULL; | 825 return NULL; |
814 } | 826 } |
815 | 827 |
816 SurfacelessEGL::~SurfacelessEGL() { | 828 SurfacelessEGL::~SurfacelessEGL() { |
817 } | 829 } |
818 | 830 |
819 } // namespace gfx | 831 } // namespace gfx |
OLD | NEW |