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.h" | 5 #include "chrome/gpu/gpu_info.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <d3d9.h> | 8 #include <d3d9.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 uint32 GPUInfo::pixel_shader_version() const { | 26 uint32 GPUInfo::pixel_shader_version() const { |
27 return pixel_shader_version_; | 27 return pixel_shader_version_; |
28 } | 28 } |
29 | 29 |
30 uint32 GPUInfo::vertex_shader_version() const { | 30 uint32 GPUInfo::vertex_shader_version() const { |
31 return vertex_shader_version_; | 31 return vertex_shader_version_; |
32 } | 32 } |
33 | 33 |
| 34 void GPUInfo::SetGraphicsInfo(uint32 vendor_id, uint32 device_id, |
| 35 const std::wstring& driver_version, |
| 36 uint32 pixel_shader_version, |
| 37 uint32 vertex_shader_version) { |
| 38 vendor_id_ = vendor_id; |
| 39 device_id_ = device_id; |
| 40 driver_version_ = driver_version; |
| 41 pixel_shader_version_ = pixel_shader_version; |
| 42 vertex_shader_version_ = vertex_shader_version; |
| 43 } |
| 44 |
34 bool GPUInfo::CollectGraphicsInfo() { | 45 bool GPUInfo::CollectGraphicsInfo() { |
35 FilePath d3d_path(base::GetNativeLibraryName(L"d3d9")); | 46 FilePath d3d_path(base::GetNativeLibraryName(L"d3d9")); |
36 base::ScopedNativeLibrary d3dlib(d3d_path); | 47 base::ScopedNativeLibrary d3dlib(d3d_path); |
37 | 48 |
38 typedef IDirect3D9* (WINAPI *Direct3DCreate9Proc)(UINT); | 49 typedef IDirect3D9* (WINAPI *Direct3DCreate9Proc)(UINT); |
39 Direct3DCreate9Proc d3d_create_proc = | 50 Direct3DCreate9Proc d3d_create_proc = |
40 static_cast<Direct3DCreate9Proc>( | 51 static_cast<Direct3DCreate9Proc>( |
41 d3dlib.GetFunctionPointer("Direct3DCreate9")); | 52 d3dlib.GetFunctionPointer("Direct3DCreate9")); |
42 | 53 |
43 if (!d3d_create_proc) { | 54 if (!d3d_create_proc) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return false; | 114 return false; |
104 } | 115 } |
105 std::wstring vendorid = id.substr(8, 4); | 116 std::wstring vendorid = id.substr(8, 4); |
106 std::wstring deviceid = id.substr(17, 4); | 117 std::wstring deviceid = id.substr(17, 4); |
107 swscanf_s(vendorid.c_str(), L"%x", &vendor_id_); | 118 swscanf_s(vendorid.c_str(), L"%x", &vendor_id_); |
108 swscanf_s(deviceid.c_str(), L"%x", &device_id_); | 119 swscanf_s(deviceid.c_str(), L"%x", &device_id_); |
109 return true; | 120 return true; |
110 | 121 |
111 // TODO(rlp): Add driver and pixel versions | 122 // TODO(rlp): Add driver and pixel versions |
112 } | 123 } |
OLD | NEW |