Index: ui/gl/gl_surface_win.cc |
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc |
index 7540b1fc35d6125c14f3aef83327cd83bbfe37cc..60f0acde2eaaf31fd65afe1c684ab72ac0ae3600 100644 |
--- a/ui/gl/gl_surface_win.cc |
+++ b/ui/gl/gl_surface_win.cc |
@@ -20,8 +20,26 @@ |
#include "ui/gl/gl_surface_stub.h" |
#include "ui/gl/gl_surface_wgl.h" |
+// From ANGLE's egl/eglext.h. |
+#if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) |
+#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ |
+ reinterpret_cast<EGLNativeDisplayType>(-2) |
+#endif |
+ |
namespace gfx { |
+namespace { |
+ |
+EGLNativeDisplayType GetEGLDisplay() { |
+ EGLNativeDisplayType_native_display = EGL_DEFAULT_DISPLAY; |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) && |
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableD3D11)) { |
+ native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; |
+ } |
+ |
+ return native_display; |
+} |
+ |
// This OSMesa GL surface can use GDI to swap the contents of the buffer to a |
// view. |
class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
@@ -94,7 +112,7 @@ bool GLSurface::InitializeOneOffInternal() { |
} |
break; |
case kGLImplementationEGLGLES2: |
- if (!GLSurfaceEGL::InitializeOneOff()) { |
+ if (!GLSurfaceEGL::InitializeOneOff(GetEGLDisplay())) { |
LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
return false; |
} |