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 19 matching lines...) Expand all Loading... |
30 return false; | 30 return false; |
31 | 31 |
32 IDirect3DDevice9* device = display->getDevice(); | 32 IDirect3DDevice9* device = display->getDevice(); |
33 if (!device) | 33 if (!device) |
34 return false; | 34 return false; |
35 | 35 |
36 IDirect3D9* d3d = NULL; | 36 IDirect3D9* d3d = NULL; |
37 if (FAILED(device->GetDirect3D(&d3d))) | 37 if (FAILED(device->GetDirect3D(&d3d))) |
38 return false; | 38 return false; |
39 | 39 |
40 // Don't fail if DirectX diagnostics are not available. Just leave the tree | 40 if (!CollectGraphicsInfoD3D(d3d, gpu_info)) |
41 // empty. The other GPU info is still valuable. | 41 return false; |
42 DxDiagNode dx_diagnostics; | |
43 if (GetDxDiagnostics(&dx_diagnostics)) | |
44 gpu_info->SetDxDiagnostics(dx_diagnostics); | |
45 | 42 |
46 return CollectGraphicsInfoD3D(d3d, gpu_info); | 43 // DirectX diagnostics are collected asynchronously because it takes a |
| 44 // couple of seconds. Do not mark as complete until that is done. |
| 45 gpu_info->SetProgress(GPUInfo::kPartial); |
| 46 |
| 47 return true; |
47 } | 48 } |
48 | 49 |
49 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { | 50 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { |
50 DCHECK(d3d); | 51 DCHECK(d3d); |
51 DCHECK(gpu_info); | 52 DCHECK(gpu_info); |
52 | 53 |
53 // Get device information | 54 // Get device information |
54 D3DADAPTER_IDENTIFIER9 identifier; | 55 D3DADAPTER_IDENTIFIER9 identifier; |
55 HRESULT hr = d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &identifier); | 56 HRESULT hr = d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &identifier); |
56 if (hr != D3D_OK) { | 57 if (hr != D3D_OK) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 pixel_shader_version, | 134 pixel_shader_version, |
134 vertex_shader_version, | 135 vertex_shader_version, |
135 0, // GL version of 0 indicates D3D | 136 0, // GL version of 0 indicates D3D |
136 false); | 137 false); |
137 return true; | 138 return true; |
138 | 139 |
139 // TODO(rlp): Add driver and pixel versions | 140 // TODO(rlp): Add driver and pixel versions |
140 } | 141 } |
141 | 142 |
142 } // namespace gpu_info_collector | 143 } // namespace gpu_info_collector |
OLD | NEW |