OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <windows.h> | 7 #include <windows.h> |
8 #include <d3d9.h> | 8 #include <d3d9.h> |
9 | 9 |
10 #include "app/gfx/gl/gl_context_egl.h" | 10 #include "app/gfx/gl/gl_context_egl.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 if (!CollectGraphicsInfoD3D(d3d, gpu_info)) | 47 if (!CollectGraphicsInfoD3D(d3d, gpu_info)) |
48 return false; | 48 return false; |
49 | 49 |
50 // DirectX diagnostics are collected asynchronously because it takes a | 50 // DirectX diagnostics are collected asynchronously because it takes a |
51 // couple of seconds. Do not mark as complete until that is done. | 51 // couple of seconds. Do not mark as complete until that is done. |
52 gpu_info->SetLevel(GPUInfo::kPartial); | 52 gpu_info->SetLevel(GPUInfo::kPartial); |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
| 56 bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { |
| 57 DCHECK(gpu_info); |
| 58 |
| 59 gpu_info->SetLevel(GPUInfo::kPartial); |
| 60 |
| 61 bool rt = true; |
| 62 if (!CollectVideoCardInfo(gpu_info)) |
| 63 rt = false; |
| 64 |
| 65 return rt; |
| 66 } |
| 67 |
56 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { | 68 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { |
57 DCHECK(d3d); | 69 DCHECK(d3d); |
58 DCHECK(gpu_info); | 70 DCHECK(gpu_info); |
59 | 71 |
60 bool succeed = true; | 72 bool succeed = true; |
61 | 73 |
62 // Get device/driver information | 74 // Get device/driver information |
63 D3DADAPTER_IDENTIFIER9 identifier; | 75 D3DADAPTER_IDENTIFIER9 identifier; |
64 if (d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &identifier) == D3D_OK) { | 76 if (d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &identifier) == D3D_OK) { |
65 gpu_info->SetVideoCardInfo(identifier.VendorId, identifier.DeviceId); | 77 gpu_info->SetVideoCardInfo(identifier.VendorId, identifier.DeviceId); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 153 |
142 size_t pos = gl_version_string.find_last_not_of("0123456789."); | 154 size_t pos = gl_version_string.find_last_not_of("0123456789."); |
143 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { | 155 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { |
144 gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1)); | 156 gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1)); |
145 return true; | 157 return true; |
146 } | 158 } |
147 return false; | 159 return false; |
148 } | 160 } |
149 | 161 |
150 } // namespace gpu_info_collector | 162 } // namespace gpu_info_collector |
OLD | NEW |