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 #ifndef CHROME_COMMON_GPU_INFO_H__ | 5 #ifndef CHROME_COMMON_GPU_INFO_H__ |
6 #define CHROME_COMMON_GPU_INFO_H__ | 6 #define CHROME_COMMON_GPU_INFO_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // Provides access to the GPU information for the system | 9 // Provides access to the GPU information for the system |
10 // on which chrome is currently running. | 10 // on which chrome is currently running. |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/scoped_ptr.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
17 #include "chrome/common/dx_diag_node.h" | 18 #include "chrome/common/dx_diag_node.h" |
18 | 19 |
19 class GPUInfo { | 20 class GPUInfo { |
20 public: | 21 public: |
21 GPUInfo(); | 22 GPUInfo(); |
22 ~GPUInfo() {} | 23 ~GPUInfo() {} |
23 | 24 |
24 enum Progress { | 25 enum Progress { |
(...skipping 10 matching lines...) Expand all Loading... |
35 // loop being pumped. | 36 // loop being pumped. |
36 base::TimeDelta initialization_time() const; | 37 base::TimeDelta initialization_time() const; |
37 | 38 |
38 // Return the DWORD (uint32) representing the graphics card vendor id. | 39 // Return the DWORD (uint32) representing the graphics card vendor id. |
39 uint32 vendor_id() const; | 40 uint32 vendor_id() const; |
40 | 41 |
41 // Return the DWORD (uint32) representing the graphics card device id. | 42 // Return the DWORD (uint32) representing the graphics card device id. |
42 // Device ids are unique to vendor, not to one another. | 43 // Device ids are unique to vendor, not to one another. |
43 uint32 device_id() const; | 44 uint32 device_id() const; |
44 | 45 |
| 46 // Return the vendor of the graphics driver currently installed. |
| 47 std::string driver_vendor() const; |
| 48 |
45 // Return the version of the graphics driver currently installed. | 49 // Return the version of the graphics driver currently installed. |
46 // This will typically be something | 50 std::string driver_version() const; |
47 std::wstring driver_version() const; | |
48 | 51 |
49 // Return the version of the pixel/fragment shader used by the gpu. | 52 // Return the version of the pixel/fragment shader used by the gpu. |
50 // This will typically be a number less than 10 so storing as a float | 53 // Major version in the second lowest 8 bits, minor in the lowest 8 bits, |
51 // should be okay. | 54 // eg version 2.5 would be 0x00000205. |
52 uint32 pixel_shader_version() const; | 55 uint32 pixel_shader_version() const; |
53 | 56 |
54 // Return the version of the vertex shader used by the gpu. | 57 // Return the version of the vertex shader used by the gpu. |
55 // This will typically be a number less than 10 so storing as a float | 58 // Major version in the second lowest 8 bits, minor in the lowest 8 bits, |
56 // should be okay. | 59 // eg version 2.5 would be 0x00000205. |
57 uint32 vertex_shader_version() const; | 60 uint32 vertex_shader_version() const; |
58 | 61 |
59 // Return the version of OpenGL we are using. | 62 // Return the version of OpenGL we are using. |
60 // Major version in the high word, minor in the low word, eg version 2.5 | 63 // Major version in the second lowest 8 bits, minor in the lowest 8 bits, |
61 // would be 0x00020005. | 64 // eg version 2.5 would be 0x00000205. |
62 // Returns 0 if we're not using OpenGL, say because we're going through | 65 // Returns 0 if we're not using OpenGL, say because we're going through |
63 // D3D instead. | 66 // D3D instead. |
| 67 // TODO(zmo): should be able to tell if it's GL or GLES. |
64 uint32 gl_version() const; | 68 uint32 gl_version() const; |
65 | 69 |
| 70 // Return the GL_VERSION string. |
| 71 // Return "" if we are not using OpenGL. |
| 72 std::string gl_version_string() const; |
| 73 |
| 74 // Return the GL_VENDOR string. |
| 75 // Return "" if we are not using OpenGL. |
| 76 std::string gl_vendor() const; |
| 77 |
| 78 // Return the GL_RENDERER string. |
| 79 // Return "" if we are not using OpenGL. |
| 80 std::string gl_renderer() const; |
| 81 |
66 // Return the device semantics, i.e. whether the Vista and Windows 7 specific | 82 // Return the device semantics, i.e. whether the Vista and Windows 7 specific |
67 // semantics are available. | 83 // semantics are available. |
68 bool can_lose_context() const; | 84 bool can_lose_context() const; |
69 | 85 |
70 void SetProgress(Progress progress); | 86 void SetProgress(Progress progress); |
71 | 87 |
72 void SetInitializationTime(const base::TimeDelta& initialization_time); | 88 void SetInitializationTime(const base::TimeDelta& initialization_time); |
73 | 89 |
74 // Populate variables with passed in values | 90 void SetVideoCardInfo(uint32 vendor_id, uint32 device_id); |
75 void SetGraphicsInfo(uint32 vendor_id, uint32 device_id, | 91 |
76 const std::wstring& driver_version, | 92 void SetDriverInfo(const std::string& driver_vendor, |
77 uint32 pixel_shader_version, | 93 const std::string& driver_version); |
78 uint32 vertex_shader_version, | 94 |
79 uint32 gl_version, | 95 void SetShaderVersion(uint32 pixel_shader_version, |
80 bool can_lose_context); | 96 uint32 vertex_shader_version); |
| 97 |
| 98 void SetGLVersion(uint32 gl_version); |
| 99 |
| 100 void SetGLVersionString(const std::string& gl_vendor_string); |
| 101 |
| 102 void SetGLVendor(const std::string& gl_vendor); |
| 103 |
| 104 void SetGLRenderer(const std::string& gl_renderer); |
| 105 |
| 106 void SetCanLoseContext(bool can_lose_context); |
81 | 107 |
82 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
83 // The information returned by the DirectX Diagnostics Tool. | 109 // The information returned by the DirectX Diagnostics Tool. |
84 const DxDiagNode& dx_diagnostics() const; | 110 const DxDiagNode& dx_diagnostics() const; |
85 | 111 |
86 void SetDxDiagnostics(const DxDiagNode& dx_diagnostics); | 112 void SetDxDiagnostics(const DxDiagNode& dx_diagnostics); |
87 #endif | 113 #endif |
88 | 114 |
89 private: | 115 private: |
90 Progress progress_; | 116 Progress progress_; |
91 base::TimeDelta initialization_time_; | 117 base::TimeDelta initialization_time_; |
92 uint32 vendor_id_; | 118 uint32 vendor_id_; |
93 uint32 device_id_; | 119 uint32 device_id_; |
94 std::wstring driver_version_; | 120 std::string driver_vendor_; |
| 121 std::string driver_version_; |
95 uint32 pixel_shader_version_; | 122 uint32 pixel_shader_version_; |
96 uint32 vertex_shader_version_; | 123 uint32 vertex_shader_version_; |
97 uint32 gl_version_; | 124 uint32 gl_version_; |
| 125 std::string gl_version_string_; |
| 126 std::string gl_vendor_; |
| 127 std::string gl_renderer_; |
98 bool can_lose_context_; | 128 bool can_lose_context_; |
99 | 129 |
100 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
101 DxDiagNode dx_diagnostics_; | 131 DxDiagNode dx_diagnostics_; |
102 #endif | 132 #endif |
103 }; | 133 }; |
104 | 134 |
105 #endif // CHROME_COMMON_GPU_INFO_H__ | 135 #endif // CHROME_COMMON_GPU_INFO_H__ |
OLD | NEW |