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/common/gpu_info.h" | 5 #include "chrome/common/gpu_info.h" |
6 | 6 |
7 GPUInfo::GPUInfo() | 7 GPUInfo::GPUInfo() |
8 : progress_(kUninitialized), | 8 : progress_(kUninitialized), |
9 vendor_id_(0), | 9 vendor_id_(0), |
10 device_id_(0), | 10 device_id_(0), |
11 driver_version_(L""), | 11 driver_vendor_(""), |
| 12 driver_version_(""), |
12 pixel_shader_version_(0), | 13 pixel_shader_version_(0), |
13 vertex_shader_version_(0), | 14 vertex_shader_version_(0), |
14 gl_version_(0), | 15 gl_version_(0), |
| 16 gl_version_string_(""), |
| 17 gl_vendor_(""), |
| 18 gl_renderer_(""), |
15 can_lose_context_(false) { | 19 can_lose_context_(false) { |
16 } | 20 } |
17 | 21 |
18 GPUInfo::Progress GPUInfo::progress() const { | 22 GPUInfo::Progress GPUInfo::progress() const { |
19 return progress_; | 23 return progress_; |
20 } | 24 } |
21 | 25 |
22 base::TimeDelta GPUInfo::initialization_time() const { | 26 base::TimeDelta GPUInfo::initialization_time() const { |
23 return initialization_time_; | 27 return initialization_time_; |
24 } | 28 } |
25 | 29 |
26 uint32 GPUInfo::vendor_id() const { | 30 uint32 GPUInfo::vendor_id() const { |
27 return vendor_id_; | 31 return vendor_id_; |
28 } | 32 } |
29 | 33 |
30 uint32 GPUInfo::device_id() const { | 34 uint32 GPUInfo::device_id() const { |
31 return device_id_; | 35 return device_id_; |
32 } | 36 } |
33 | 37 |
34 std::wstring GPUInfo::driver_version() const { | 38 std::string GPUInfo::driver_vendor() const { |
| 39 return driver_vendor_; |
| 40 } |
| 41 |
| 42 std::string GPUInfo::driver_version() const { |
35 return driver_version_; | 43 return driver_version_; |
36 } | 44 } |
37 | 45 |
38 uint32 GPUInfo::pixel_shader_version() const { | 46 uint32 GPUInfo::pixel_shader_version() const { |
39 return pixel_shader_version_; | 47 return pixel_shader_version_; |
40 } | 48 } |
41 | 49 |
42 uint32 GPUInfo::vertex_shader_version() const { | 50 uint32 GPUInfo::vertex_shader_version() const { |
43 return vertex_shader_version_; | 51 return vertex_shader_version_; |
44 } | 52 } |
45 | 53 |
46 uint32 GPUInfo::gl_version() const { | 54 uint32 GPUInfo::gl_version() const { |
47 return gl_version_; | 55 return gl_version_; |
48 } | 56 } |
49 | 57 |
| 58 std::string GPUInfo::gl_version_string() const { |
| 59 return gl_version_string_; |
| 60 } |
| 61 |
| 62 std::string GPUInfo::gl_vendor() const { |
| 63 return gl_vendor_; |
| 64 } |
| 65 |
| 66 std::string GPUInfo::gl_renderer() const { |
| 67 return gl_renderer_; |
| 68 } |
50 | 69 |
51 bool GPUInfo::can_lose_context() const { | 70 bool GPUInfo::can_lose_context() const { |
52 return can_lose_context_; | 71 return can_lose_context_; |
53 } | 72 } |
54 | 73 |
| 74 void GPUInfo::SetProgress(Progress progress) { |
| 75 progress_ = progress; |
| 76 } |
| 77 |
55 void GPUInfo::SetInitializationTime( | 78 void GPUInfo::SetInitializationTime( |
56 const base::TimeDelta& initialization_time) { | 79 const base::TimeDelta& initialization_time) { |
57 initialization_time_ = initialization_time; | 80 initialization_time_ = initialization_time; |
58 } | 81 } |
59 | 82 |
60 | 83 void GPUInfo::SetVideoCardInfo(uint32 vendor_id, uint32 device_id) { |
61 void GPUInfo::SetGraphicsInfo(uint32 vendor_id, uint32 device_id, | |
62 const std::wstring& driver_version, | |
63 uint32 pixel_shader_version, | |
64 uint32 vertex_shader_version, | |
65 uint32 gl_version, | |
66 bool can_lose_context) { | |
67 vendor_id_ = vendor_id; | 84 vendor_id_ = vendor_id; |
68 device_id_ = device_id; | 85 device_id_ = device_id; |
| 86 } |
| 87 |
| 88 void GPUInfo::SetDriverInfo(const std::string& driver_vendor, |
| 89 const std::string& driver_version) { |
| 90 driver_vendor_ = driver_vendor; |
69 driver_version_ = driver_version; | 91 driver_version_ = driver_version; |
| 92 } |
| 93 |
| 94 void GPUInfo::SetShaderVersion(uint32 pixel_shader_version, |
| 95 uint32 vertex_shader_version) { |
70 pixel_shader_version_ = pixel_shader_version; | 96 pixel_shader_version_ = pixel_shader_version; |
71 vertex_shader_version_ = vertex_shader_version; | 97 vertex_shader_version_ = vertex_shader_version; |
72 gl_version_ = gl_version; | |
73 can_lose_context_ = can_lose_context; | |
74 } | 98 } |
75 | 99 |
76 void GPUInfo::SetProgress(Progress progress) { | 100 void GPUInfo::SetGLVersion(uint32 gl_version) { |
77 progress_ = progress; | 101 gl_version_ = gl_version; |
| 102 } |
| 103 |
| 104 void GPUInfo::SetGLVersionString(const std::string& gl_version_string) { |
| 105 gl_version_string_ = gl_version_string; |
| 106 } |
| 107 |
| 108 void GPUInfo::SetGLVendor(const std::string& gl_vendor) { |
| 109 gl_vendor_ = gl_vendor; |
| 110 } |
| 111 |
| 112 void GPUInfo::SetGLRenderer(const std::string& gl_renderer) { |
| 113 gl_renderer_ = gl_renderer; |
| 114 } |
| 115 |
| 116 void GPUInfo::SetCanLoseContext(bool can_lose_context) { |
| 117 can_lose_context_ = can_lose_context; |
78 } | 118 } |
79 | 119 |
80 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
81 const DxDiagNode& GPUInfo::dx_diagnostics() const { | 121 const DxDiagNode& GPUInfo::dx_diagnostics() const { |
82 return dx_diagnostics_; | 122 return dx_diagnostics_; |
83 } | 123 } |
84 | 124 |
85 void GPUInfo::SetDxDiagnostics(const DxDiagNode& dx_diagnostics) { | 125 void GPUInfo::SetDxDiagnostics(const DxDiagNode& dx_diagnostics) { |
86 dx_diagnostics_ = dx_diagnostics; | 126 dx_diagnostics_ = dx_diagnostics; |
87 } | 127 } |
88 #endif | 128 #endif |
OLD | NEW |