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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 2541843004: Add a version of gpu_fuzzer that is backed by the NULL ANGLE backend (Closed)
Patch Set: Created 4 years 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
« gpu/BUILD.gn ('K') | « gpu/command_buffer/tests/fuzzer_main.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 0bce1d00911a2be32ed9ca1f70446fe8468112c5..a02ee74122d8ba9a33b30d3fc4b34d7c99a4e713 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -148,11 +148,15 @@ EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
}
#if defined(USE_X11) && !defined(OS_CHROMEOS)
- Visual* visual;
- ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
- true, &visual, nullptr, nullptr, nullptr);
- display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE);
- display_attribs.push_back(static_cast<EGLint>(XVisualIDFromVisual(visual)));
+ // ANGLE_NULL doesn't use the visual, and may run without X11 where we can't
+ // get it anyway.
+ if (platform_type != EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE) {
+ Visual* visual;
+ ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+ true, &visual, nullptr, nullptr, nullptr);
+ display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE);
+ display_attribs.push_back(static_cast<EGLint>(XVisualIDFromVisual(visual)));
+ }
#endif
display_attribs.push_back(EGL_NONE);
@@ -243,9 +247,13 @@ EGLConfig ChooseConfig(GLSurface::Format format) {
EGLint alpha_size = 8;
#if defined(USE_X11) && !defined(OS_CHROMEOS)
- ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
- true, nullptr, &buffer_size, nullptr, nullptr);
- alpha_size = buffer_size == 32 ? 8 : 0;
+ // If we're using ANGLE_NULL, we may not have a display, in which case we
+ // can't use XVisualManager.
+ if (g_native_display) {
+ ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+ true, nullptr, &buffer_size, nullptr, nullptr);
+ alpha_size = buffer_size == 32 ? 8 : 0;
+ }
#endif
EGLint surface_type = (format == GLSurface::SURFACE_SURFACELESS)
« gpu/BUILD.gn ('K') | « gpu/command_buffer/tests/fuzzer_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698