OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "chrome/gpu/gpu_info_collector.h" | 5 #include "chrome/gpu/gpu_info_collector.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/gfx/gl/gl_bindings.h" | 10 #include "app/gfx/gl/gl_bindings.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { | 82 bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { |
83 DCHECK(gpu_info); | 83 DCHECK(gpu_info); |
84 | 84 |
85 gfx::GLContext* context = InitializeGLContext(); | 85 gfx::GLContext* context = InitializeGLContext(); |
86 if (context == NULL) | 86 if (context == NULL) |
87 return false; | 87 return false; |
88 | 88 |
89 gpu_info->SetGLRenderer(GetGLString(GL_RENDERER)); | 89 gpu_info->SetGLRenderer(GetGLString(GL_RENDERER)); |
90 gpu_info->SetGLVendor(GetGLString(GL_VENDOR)); | 90 gpu_info->SetGLVendor(GetGLString(GL_VENDOR)); |
91 gpu_info->SetGLVersionString(GetGLString(GL_VERSION)); | 91 gpu_info->SetGLVersionString(GetGLString(GL_VERSION)); |
92 gpu_info->SetGLExtensions(GetGLString(GL_EXTENSIONS)); | |
93 | 92 |
94 bool validGLVersionInfo = CollectGLVersionInfo(gpu_info); | 93 bool validGLVersionInfo = CollectGLVersionInfo(gpu_info); |
95 bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); | 94 bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); |
96 bool validDriverInfo = CollectDriverInfo(gpu_info); | 95 bool validDriverInfo = CollectDriverInfo(gpu_info); |
97 | 96 |
98 FinalizeGLContext(&context); | 97 FinalizeGLContext(&context); |
99 | 98 |
100 return (validGLVersionInfo && validVideoCardInfo && validDriverInfo); | 99 return (validGLVersionInfo && validVideoCardInfo && validDriverInfo); |
101 } | 100 } |
102 | 101 |
103 bool CollectGLVersionInfo(GPUInfo* gpu_info) { | 102 bool CollectGLVersionInfo(GPUInfo* gpu_info) { |
104 DCHECK(gpu_info); | 103 DCHECK(gpu_info); |
105 | 104 |
106 std::string gl_version_string = gpu_info->gl_version_string(); | 105 std::string gl_version_string = gpu_info->gl_version_string(); |
107 std::string glsl_version_string = | 106 std::string glsl_version_string = |
108 GetGLString(GL_SHADING_LANGUAGE_VERSION); | 107 GetGLString(GL_SHADING_LANGUAGE_VERSION); |
109 | 108 |
110 uint32 gl_version = GetVersionNumberFromString(gl_version_string); | 109 uint32 gl_version = GetVersionNumberFromString(gl_version_string); |
111 gpu_info->SetGLVersion(gl_version); | 110 gpu_info->SetGLVersion(gl_version); |
112 | 111 |
113 uint32 glsl_version = GetVersionNumberFromString(glsl_version_string); | 112 uint32 glsl_version = GetVersionNumberFromString(glsl_version_string); |
114 gpu_info->SetShaderVersion(glsl_version, glsl_version); | 113 gpu_info->SetShaderVersion(glsl_version, glsl_version); |
115 | 114 |
116 return true; | 115 return true; |
117 } | 116 } |
118 | 117 |
119 } // namespace gpu_info_collector | 118 } // namespace gpu_info_collector |
120 | 119 |
OLD | NEW |