Chromium Code Reviews| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B | 70 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B |
| 71 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C | 71 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C |
| 72 #endif /* EGL_ANGLE_platform_angle_d3d */ | 72 #endif /* EGL_ANGLE_platform_angle_d3d */ |
| 73 | 73 |
| 74 #ifndef EGL_ANGLE_platform_angle_opengl | 74 #ifndef EGL_ANGLE_platform_angle_opengl |
| 75 #define EGL_ANGLE_platform_angle_opengl 1 | 75 #define EGL_ANGLE_platform_angle_opengl 1 |
| 76 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D | 76 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D |
| 77 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E | 77 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E |
| 78 #endif /* EGL_ANGLE_platform_angle_opengl */ | 78 #endif /* EGL_ANGLE_platform_angle_opengl */ |
| 79 | 79 |
| 80 #ifndef EGL_ANGLE_platform_angle_null | |
| 81 #define EGL_ANGLE_platform_angle_null 1 | |
| 82 #define EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE 0x33AE | |
| 83 #endif /* EGL_ANGLE_platform_angle_null */ | |
| 84 | |
| 80 #ifndef EGL_ANGLE_x11_visual | 85 #ifndef EGL_ANGLE_x11_visual |
| 81 #define EGL_ANGLE_x11_visual 1 | 86 #define EGL_ANGLE_x11_visual 1 |
| 82 #define EGL_X11_VISUAL_ID_ANGLE 0x33A3 | 87 #define EGL_X11_VISUAL_ID_ANGLE 0x33A3 |
| 83 #endif /* EGL_ANGLE_x11_visual */ | 88 #endif /* EGL_ANGLE_x11_visual */ |
| 84 | 89 |
| 85 #ifndef EGL_ANGLE_surface_orientation | 90 #ifndef EGL_ANGLE_surface_orientation |
| 86 #define EGL_ANGLE_surface_orientation | 91 #define EGL_ANGLE_surface_orientation |
| 87 #define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7 | 92 #define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7 |
| 88 #define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8 | 93 #define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8 |
| 89 #define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001 | 94 #define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, false); | 171 EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, false); |
| 167 case ANGLE_D3D11: | 172 case ANGLE_D3D11: |
| 168 return GetPlatformANGLEDisplay( | 173 return GetPlatformANGLEDisplay( |
| 169 native_display, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, false); | 174 native_display, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, false); |
| 170 case ANGLE_OPENGL: | 175 case ANGLE_OPENGL: |
| 171 return GetPlatformANGLEDisplay( | 176 return GetPlatformANGLEDisplay( |
| 172 native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, false); | 177 native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, false); |
| 173 case ANGLE_OPENGLES: | 178 case ANGLE_OPENGLES: |
| 174 return GetPlatformANGLEDisplay( | 179 return GetPlatformANGLEDisplay( |
| 175 native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, false); | 180 native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, false); |
| 181 case ANGLE_NULL: | |
| 182 return GetPlatformANGLEDisplay( | |
| 183 native_display, EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE, false); | |
| 176 default: | 184 default: |
| 177 NOTREACHED(); | 185 NOTREACHED(); |
| 178 return EGL_NO_DISPLAY; | 186 return EGL_NO_DISPLAY; |
| 179 } | 187 } |
| 180 } | 188 } |
| 181 | 189 |
| 182 const char* DisplayTypeString(DisplayType display_type) { | 190 const char* DisplayTypeString(DisplayType display_type) { |
| 183 switch (display_type) { | 191 switch (display_type) { |
| 184 case DEFAULT: | 192 case DEFAULT: |
| 185 return "Default"; | 193 return "Default"; |
| 186 case SWIFT_SHADER: | 194 case SWIFT_SHADER: |
| 187 return "SwiftShader"; | 195 return "SwiftShader"; |
| 188 case ANGLE_D3D9: | 196 case ANGLE_D3D9: |
| 189 return "D3D9"; | 197 return "D3D9"; |
| 190 case ANGLE_D3D11: | 198 case ANGLE_D3D11: |
| 191 return "D3D11"; | 199 return "D3D11"; |
| 192 case ANGLE_OPENGL: | 200 case ANGLE_OPENGL: |
| 193 return "OpenGL"; | 201 return "OpenGL"; |
| 194 case ANGLE_OPENGLES: | 202 case ANGLE_OPENGLES: |
| 195 return "OpenGLES"; | 203 return "OpenGLES"; |
| 204 case ANGLE_NULL: | |
| 205 return "Null"; | |
| 196 default: | 206 default: |
| 197 NOTREACHED(); | 207 NOTREACHED(); |
| 198 return "Err"; | 208 return "Err"; |
| 199 } | 209 } |
| 200 } | 210 } |
| 201 | 211 |
| 202 bool ValidateEglConfig(EGLDisplay display, | 212 bool ValidateEglConfig(EGLDisplay display, |
| 203 const EGLint* config_attribs, | 213 const EGLint* config_attribs, |
| 204 EGLint* num_configs) { | 214 EGLint* num_configs) { |
| 205 if (!eglChooseConfig(display, | 215 if (!eglChooseConfig(display, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 return; | 366 return; |
| 357 } | 367 } |
| 358 | 368 |
| 359 std::string requested_renderer = | 369 std::string requested_renderer = |
| 360 command_line->GetSwitchValueASCII(switches::kUseANGLE); | 370 command_line->GetSwitchValueASCII(switches::kUseANGLE); |
| 361 | 371 |
| 362 bool use_angle_default = | 372 bool use_angle_default = |
| 363 !command_line->HasSwitch(switches::kUseANGLE) || | 373 !command_line->HasSwitch(switches::kUseANGLE) || |
| 364 requested_renderer == kANGLEImplementationDefaultName; | 374 requested_renderer == kANGLEImplementationDefaultName; |
| 365 | 375 |
| 376 if (requested_renderer == kANGLEImplementationNullName) | |
|
Geoff Lang
2016/10/19 16:23:09
We should check for the extension first.
piman
2016/10/19 18:03:01
Done.
| |
| 377 init_displays->push_back(ANGLE_NULL); | |
| 378 | |
| 366 if (supports_angle_d3d) { | 379 if (supports_angle_d3d) { |
| 367 if (use_angle_default) { | 380 if (use_angle_default) { |
| 368 // Default mode for ANGLE - try D3D11, else try D3D9 | 381 // Default mode for ANGLE - try D3D11, else try D3D9 |
| 369 if (!command_line->HasSwitch(switches::kDisableD3D11)) { | 382 if (!command_line->HasSwitch(switches::kDisableD3D11)) { |
| 370 init_displays->push_back(ANGLE_D3D11); | 383 init_displays->push_back(ANGLE_D3D11); |
| 371 } | 384 } |
| 372 init_displays->push_back(ANGLE_D3D9); | 385 init_displays->push_back(ANGLE_D3D9); |
| 373 } else { | 386 } else { |
| 374 if (requested_renderer == kANGLEImplementationD3D11Name) { | 387 if (requested_renderer == kANGLEImplementationD3D11Name) { |
| 375 init_displays->push_back(ANGLE_D3D11); | 388 init_displays->push_back(ANGLE_D3D11); |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 } | 1192 } |
| 1180 | 1193 |
| 1181 void* SurfacelessEGL::GetShareHandle() { | 1194 void* SurfacelessEGL::GetShareHandle() { |
| 1182 return NULL; | 1195 return NULL; |
| 1183 } | 1196 } |
| 1184 | 1197 |
| 1185 SurfacelessEGL::~SurfacelessEGL() { | 1198 SurfacelessEGL::~SurfacelessEGL() { |
| 1186 } | 1199 } |
| 1187 | 1200 |
| 1188 } // namespace gl | 1201 } // namespace gl |
| OLD | NEW |