OLD | NEW |
---|---|
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
18 #include "ui/gl/gl_context.h" | 18 #include "ui/gl/gl_context.h" |
19 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
20 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
21 #include "ui/gl/gl_version_info.h" | |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { | 25 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { |
25 scoped_refptr<gfx::GLSurface> surface( | 26 scoped_refptr<gfx::GLSurface> surface( |
26 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); | 27 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); |
27 if (!surface.get()) { | 28 if (!surface.get()) { |
28 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; | 29 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; |
29 return NULL; | 30 return NULL; |
30 } | 31 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 if (!context.get()) { | 96 if (!context.get()) { |
96 LOG(ERROR) << "Could not create context for info collection."; | 97 LOG(ERROR) << "Could not create context for info collection."; |
97 return kCollectInfoFatalFailure; | 98 return kCollectInfoFatalFailure; |
98 } | 99 } |
99 | 100 |
100 gpu_info->gl_renderer = GetGLString(GL_RENDERER); | 101 gpu_info->gl_renderer = GetGLString(GL_RENDERER); |
101 gpu_info->gl_vendor = GetGLString(GL_VENDOR); | 102 gpu_info->gl_vendor = GetGLString(GL_VENDOR); |
102 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); | 103 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); |
103 gpu_info->gl_version = GetGLString(GL_VERSION); | 104 gpu_info->gl_version = GetGLString(GL_VERSION); |
104 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); | 105 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); |
106 | |
107 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(), | |
108 gpu_info->gl_renderer.c_str(), | |
109 gpu_info->gl_extensions.c_str()); | |
105 GLint max_samples = 0; | 110 GLint max_samples = 0; |
106 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); | 111 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0)) |
Zhenyao Mo
2015/11/25 18:09:25
It's more complicated. You also need to consider
| |
112 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); | |
107 gpu_info->max_msaa_samples = base::IntToString(max_samples); | 113 gpu_info->max_msaa_samples = base::IntToString(max_samples); |
108 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.MaxMSAASampleCount", max_samples); | 114 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.MaxMSAASampleCount", max_samples); |
109 | 115 |
110 gfx::GLWindowSystemBindingInfo window_system_binding_info; | 116 gfx::GLWindowSystemBindingInfo window_system_binding_info; |
111 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { | 117 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { |
112 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; | 118 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; |
113 gpu_info->gl_ws_version = window_system_binding_info.version; | 119 gpu_info->gl_ws_version = window_system_binding_info.version; |
114 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; | 120 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; |
115 gpu_info->direct_rendering = window_system_binding_info.direct_rendering; | 121 gpu_info->direct_rendering = window_system_binding_info.direct_rendering; |
116 } | 122 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 basic_gpu_info->video_decode_accelerator_supported_profiles = | 174 basic_gpu_info->video_decode_accelerator_supported_profiles = |
169 context_gpu_info.video_decode_accelerator_supported_profiles; | 175 context_gpu_info.video_decode_accelerator_supported_profiles; |
170 basic_gpu_info->video_encode_accelerator_supported_profiles = | 176 basic_gpu_info->video_encode_accelerator_supported_profiles = |
171 context_gpu_info.video_encode_accelerator_supported_profiles; | 177 context_gpu_info.video_encode_accelerator_supported_profiles; |
172 basic_gpu_info->jpeg_decode_accelerator_supported = | 178 basic_gpu_info->jpeg_decode_accelerator_supported = |
173 context_gpu_info.jpeg_decode_accelerator_supported; | 179 context_gpu_info.jpeg_decode_accelerator_supported; |
174 } | 180 } |
175 | 181 |
176 } // namespace gpu | 182 } // namespace gpu |
177 | 183 |
OLD | NEW |