Chromium Code Reviews| 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 // This will typically be something |
|
Ken Russell (switch to Gerrit)
2011/01/19 22:11:43
Could you complete this previously incomplete comm
Zhenyao Mo
2011/01/19 23:36:22
Done.
| |
| 47 std::wstring driver_version() const; | 51 std::string driver_version() const; |
| 48 | 52 |
| 49 // Return the version of the pixel/fragment shader used by the gpu. | 53 // 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 | 54 // This will typically be a number less than 10 so storing as a float |
| 51 // should be okay. | 55 // should be okay. |
| 52 uint32 pixel_shader_version() const; | 56 uint32 pixel_shader_version() const; |
| 53 | 57 |
| 54 // Return the version of the vertex shader used by the gpu. | 58 // 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 | 59 // This will typically be a number less than 10 so storing as a float |
| 56 // should be okay. | 60 // should be okay. |
| 57 uint32 vertex_shader_version() const; | 61 uint32 vertex_shader_version() const; |
| 58 | 62 |
| 59 // Return the version of OpenGL we are using. | 63 // Return the version of OpenGL we are using. |
| 60 // Major version in the high word, minor in the low word, eg version 2.5 | 64 // Major version in the high word, minor in the low word, eg version 2.5 |
| 61 // would be 0x00020005. | 65 // would be 0x00020005. |
| 62 // Returns 0 if we're not using OpenGL, say because we're going through | 66 // Returns 0 if we're not using OpenGL, say because we're going through |
| 63 // D3D instead. | 67 // D3D instead. |
| 64 uint32 gl_version() const; | 68 uint32 gl_version() const; |
|
Ken Russell (switch to Gerrit)
2011/01/19 22:11:43
How can the user of this class tell whether they'r
Zhenyao Mo
2011/01/19 23:36:22
Can't at the moment. I'll add a FIXME here.
| |
| 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 |