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

Side by Side 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 unified diff | Download patch
« gpu/BUILD.gn ('K') | « gpu/command_buffer/tests/fuzzer_main.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); 142 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
143 display_attribs.push_back(platform_type); 143 display_attribs.push_back(platform_type);
144 144
145 if (warpDevice) { 145 if (warpDevice) {
146 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); 146 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE);
147 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); 147 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
148 } 148 }
149 149
150 #if defined(USE_X11) && !defined(OS_CHROMEOS) 150 #if defined(USE_X11) && !defined(OS_CHROMEOS)
151 Visual* visual; 151 // ANGLE_NULL doesn't use the visual, and may run without X11 where we can't
152 ui::XVisualManager::GetInstance()->ChooseVisualForWindow( 152 // get it anyway.
153 true, &visual, nullptr, nullptr, nullptr); 153 if (platform_type != EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE) {
154 display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE); 154 Visual* visual;
155 display_attribs.push_back(static_cast<EGLint>(XVisualIDFromVisual(visual))); 155 ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
156 true, &visual, nullptr, nullptr, nullptr);
157 display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE);
158 display_attribs.push_back(static_cast<EGLint>(XVisualIDFromVisual(visual)));
159 }
156 #endif 160 #endif
157 161
158 display_attribs.push_back(EGL_NONE); 162 display_attribs.push_back(EGL_NONE);
159 163
160 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, 164 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,
161 reinterpret_cast<void*>(native_display), 165 reinterpret_cast<void*>(native_display),
162 &display_attribs[0]); 166 &display_attribs[0]);
163 } 167 }
164 168
165 EGLDisplay GetDisplayFromType(DisplayType display_type, 169 EGLDisplay GetDisplayFromType(DisplayType display_type,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 240 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
237 switches::kDisableES3GLContext)) { 241 switches::kDisableES3GLContext)) {
238 renderable_types.push_back(EGL_OPENGL_ES3_BIT); 242 renderable_types.push_back(EGL_OPENGL_ES3_BIT);
239 } 243 }
240 renderable_types.push_back(EGL_OPENGL_ES2_BIT); 244 renderable_types.push_back(EGL_OPENGL_ES2_BIT);
241 245
242 EGLint buffer_size = 32; 246 EGLint buffer_size = 32;
243 EGLint alpha_size = 8; 247 EGLint alpha_size = 8;
244 248
245 #if defined(USE_X11) && !defined(OS_CHROMEOS) 249 #if defined(USE_X11) && !defined(OS_CHROMEOS)
246 ui::XVisualManager::GetInstance()->ChooseVisualForWindow( 250 // If we're using ANGLE_NULL, we may not have a display, in which case we
247 true, nullptr, &buffer_size, nullptr, nullptr); 251 // can't use XVisualManager.
248 alpha_size = buffer_size == 32 ? 8 : 0; 252 if (g_native_display) {
253 ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
254 true, nullptr, &buffer_size, nullptr, nullptr);
255 alpha_size = buffer_size == 32 ? 8 : 0;
256 }
249 #endif 257 #endif
250 258
251 EGLint surface_type = (format == GLSurface::SURFACE_SURFACELESS) 259 EGLint surface_type = (format == GLSurface::SURFACE_SURFACELESS)
252 ? EGL_DONT_CARE 260 ? EGL_DONT_CARE
253 : EGL_WINDOW_BIT | EGL_PBUFFER_BIT; 261 : EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
254 262
255 for (auto renderable_type : renderable_types) { 263 for (auto renderable_type : renderable_types) {
256 EGLint config_attribs_8888[] = {EGL_BUFFER_SIZE, 264 EGLint config_attribs_8888[] = {EGL_BUFFER_SIZE,
257 buffer_size, 265 buffer_size,
258 EGL_ALPHA_SIZE, 266 EGL_ALPHA_SIZE,
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1224 }
1217 1225
1218 void* SurfacelessEGL::GetShareHandle() { 1226 void* SurfacelessEGL::GetShareHandle() {
1219 return NULL; 1227 return NULL;
1220 } 1228 }
1221 1229
1222 SurfacelessEGL::~SurfacelessEGL() { 1230 SurfacelessEGL::~SurfacelessEGL() {
1223 } 1231 }
1224 1232
1225 } // namespace gl 1233 } // namespace gl
OLDNEW
« 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