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

Side by Side Diff: gpu/config/gpu_info_collector.cc

Issue 1548893004: Allow WebGL readback for Mesa llvmpipe driver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only allow WebGL feature Created 4 years, 8 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
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 "gpu/config/gpu_info_collector.h" 5 #include "gpu/config/gpu_info_collector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/sparse_histogram.h" 16 #include "base/metrics/sparse_histogram.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "gpu/config/gpu_switches.h"
21 #include "ui/gl/gl_bindings.h" 23 #include "ui/gl/gl_bindings.h"
22 #include "ui/gl/gl_context.h" 24 #include "ui/gl/gl_context.h"
23 #include "ui/gl/gl_implementation.h" 25 #include "ui/gl/gl_implementation.h"
24 #include "ui/gl/gl_surface.h" 26 #include "ui/gl/gl_surface.h"
25 #include "ui/gl/gl_version_info.h" 27 #include "ui/gl/gl_version_info.h"
26 28
27 namespace { 29 namespace {
28 30
29 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { 31 scoped_refptr<gfx::GLSurface> InitializeGLSurface() {
30 scoped_refptr<gfx::GLSurface> surface( 32 scoped_refptr<gfx::GLSurface> surface(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 113 }
112 114
113 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); 115 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get()));
114 if (!context.get()) { 116 if (!context.get()) {
115 LOG(ERROR) << "Could not create context for info collection."; 117 LOG(ERROR) << "Could not create context for info collection.";
116 return kCollectInfoFatalFailure; 118 return kCollectInfoFatalFailure;
117 } 119 }
118 120
119 gpu_info->gl_renderer = GetGLString(GL_RENDERER); 121 gpu_info->gl_renderer = GetGLString(GL_RENDERER);
120 gpu_info->gl_vendor = GetGLString(GL_VENDOR); 122 gpu_info->gl_vendor = GetGLString(GL_VENDOR);
123 gpu_info->gl_version = GetGLString(GL_VERSION);
124
125 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
126 if (command_line->HasSwitch(switches::kGpuTestingGLVendor)) {
127 gpu_info->gl_vendor =
128 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVendor);
129 }
130 if (command_line->HasSwitch(switches::kGpuTestingGLRenderer)) {
131 gpu_info->gl_renderer =
132 command_line->GetSwitchValueASCII(switches::kGpuTestingGLRenderer);
133 }
134 if (command_line->HasSwitch(switches::kGpuTestingGLVersion)) {
135 gpu_info->gl_version =
136 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVersion);
137 }
138
121 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); 139 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext();
122 gpu_info->gl_version = GetGLString(GL_VERSION);
123 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); 140 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION);
124 141
125 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(), 142 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(),
126 gpu_info->gl_renderer.c_str(), 143 gpu_info->gl_renderer.c_str(),
127 gpu_info->gl_extensions.c_str()); 144 gpu_info->gl_extensions.c_str());
128 GLint max_samples = 0; 145 GLint max_samples = 0;
129 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0) || 146 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0) ||
130 gpu_info->gl_extensions.find("GL_ANGLE_framebuffer_multisample") != 147 gpu_info->gl_extensions.find("GL_ANGLE_framebuffer_multisample") !=
131 std::string::npos || 148 std::string::npos ||
132 gpu_info->gl_extensions.find("GL_APPLE_framebuffer_multisample") != 149 gpu_info->gl_extensions.find("GL_APPLE_framebuffer_multisample") !=
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { 282 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) {
266 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { 283 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) {
267 gpu_info->secondary_gpus[ii].active = true; 284 gpu_info->secondary_gpus[ii].active = true;
268 return; 285 return;
269 } 286 }
270 } 287 }
271 } 288 }
272 289
273 } // namespace gpu 290 } // namespace gpu
274 291
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698