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

Unified Diff: src/gpu/gl/angle/SkANGLEGLContext.cpp

Issue 1338003002: skia: Add ANGLE with GL backend to nanobench/DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove PictureRenderer changes Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContextFactory.cpp ('k') | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/angle/SkANGLEGLContext.cpp
diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp
index 8ebdcb661eacc69587feaa06ae25f919c2ea309b..64a3bdec74381365db58936fe4d43db3a424bc16 100644
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp
@@ -15,8 +15,9 @@
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
-void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay) {
+void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay, bool useGLBackend) {
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT;
eglGetPlatformDisplayEXT =
(PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT");
@@ -25,29 +26,44 @@ void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay) {
return eglGetDisplay(static_cast<EGLNativeDisplayType>(nativeDisplay));
}
- // Try for an ANGLE D3D11 context, fall back to D3D9.
- EGLint attribs[2][3] = {
- {
- EGL_PLATFORM_ANGLE_TYPE_ANGLE,
- EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
- EGL_NONE
- },
- {
- EGL_PLATFORM_ANGLE_TYPE_ANGLE,
- EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
- EGL_NONE
- }
- };
-
EGLDisplay display = EGL_NO_DISPLAY;
- for (int i = 0; i < 2 && display == EGL_NO_DISPLAY; ++i) {
+ if (useGLBackend) {
+ // Try for an ANGLE D3D11 context, fall back to D3D9.
+ EGLint attribs[3] = {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE,
+ EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE,
+ EGL_NONE
+ };
display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,
- nativeDisplay, attribs[i]);
+ nativeDisplay, attribs);
+ } else {
+ // Try for an ANGLE D3D11 context, fall back to D3D9, and finally GL.
+ EGLint attribs[3][3] = {
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE,
+ EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_NONE
+ },
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE,
+ EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
+ EGL_NONE
+ },
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE,
+ EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE,
+ EGL_NONE
+ }
+ };
+ for (int i = 0; i < 3 && display == EGL_NO_DISPLAY; ++i) {
+ display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,
+ nativeDisplay, attribs[i]);
+ }
}
return display;
}
-SkANGLEGLContext::SkANGLEGLContext()
+SkANGLEGLContext::SkANGLEGLContext(bool useGLBackend)
: fContext(EGL_NO_CONTEXT)
, fDisplay(EGL_NO_DISPLAY)
, fSurface(EGL_NO_SURFACE) {
@@ -63,7 +79,7 @@ SkANGLEGLContext::SkANGLEGLContext()
EGL_NONE
};
- fDisplay = GetD3DEGLDisplay(EGL_DEFAULT_DISPLAY);
+ fDisplay = GetD3DEGLDisplay(EGL_DEFAULT_DISPLAY, useGLBackend);
if (EGL_NO_DISPLAY == fDisplay) {
SkDebugf("Could not create EGL display!");
return;
« no previous file with comments | « src/gpu/GrContextFactory.cpp ('k') | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698