Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: ui/gl/gl_surface_win.cc

Issue 435383002: adds WARP support to Chromium, for Metro mode only, on Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move kViewerConnect Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #include "ui/gfx/frame_time.h" 14 #include "ui/gfx/frame_time.h"
15 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gl/gl_bindings.h" 16 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_implementation.h" 17 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_surface_egl.h" 18 #include "ui/gl/gl_surface_egl.h"
19 #include "ui/gl/gl_surface_osmesa.h" 19 #include "ui/gl/gl_surface_osmesa.h"
20 #include "ui/gl/gl_surface_stub.h" 20 #include "ui/gl/gl_surface_stub.h"
21 #include "ui/gl/gl_surface_wgl.h" 21 #include "ui/gl/gl_surface_wgl.h"
22 22
23 // From ANGLE's egl/eglext.h. 23 // From ANGLE's egl/eglext.h.
24 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) 24 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE)
25 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ 25 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \
26 reinterpret_cast<EGLNativeDisplayType>(-2) 26 reinterpret_cast<EGLNativeDisplayType>(-2)
27 #endif 27 #endif
28 #if !defined(EGL_PLATFORM_ANGLE_ANGLE)
29 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201
30 #endif
31 #if !defined(EGL_PLATFORM_ANGLE_TYPE_ANGLE)
32 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
33 #endif
34 #if !defined(EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
35 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206
36 #endif
28 37
29 namespace gfx { 38 namespace gfx {
30 39
31 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a 40 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a
32 // view. 41 // view.
33 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { 42 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
34 public: 43 public:
35 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); 44 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window);
36 virtual ~NativeViewGLSurfaceOSMesa(); 45 virtual ~NativeViewGLSurfaceOSMesa();
37 46
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 296 }
288 case kGLImplementationMockGL: 297 case kGLImplementationMockGL:
289 return new GLSurfaceStub; 298 return new GLSurfaceStub;
290 default: 299 default:
291 NOTREACHED(); 300 NOTREACHED();
292 return NULL; 301 return NULL;
293 } 302 }
294 } 303 }
295 304
296 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 305 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
297 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) 306 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) ||
298 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; 307 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp))
299 308 return GetDC(NULL);
Ken Russell (switch to Gerrit) 2014/09/02 23:57:29 Is GetDC(NULL) the correct return value when --dis
luken 2014/09/03 00:58:07 It turns out that ANGLE always wants a valid Devic
300 return EGL_DEFAULT_DISPLAY; 309 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
301 } 310 }
302 311
303 } // namespace gfx 312 } // namespace gfx
OLDNEW
« ui/base/ui_base_switches.cc ('K') | « ui/gl/gl_surface_egl.cc ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698