summaryrefslogtreecommitdiffstats
path: root/chrome/common/gpu_info.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/gpu_info.h')
-rw-r--r--chrome/common/gpu_info.h82
1 files changed, 60 insertions, 22 deletions
diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h
index b8f7cc6..3b8e0e6 100644
--- a/chrome/common/gpu_info.h
+++ b/chrome/common/gpu_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
#include "base/time.h"
#include "build/build_config.h"
#include "chrome/common/dx_diag_node.h"
@@ -19,17 +20,18 @@
class GPUInfo {
public:
GPUInfo();
- ~GPUInfo() {}
+ ~GPUInfo();
- enum Progress {
+ enum Level {
kUninitialized,
kPartial,
+ kCompleting,
kComplete,
};
// Returns whether this GPUInfo has been partially or fully initialized with
// information.
- Progress progress() const;
+ Level level() const;
// The amount of time taken to get from the process starting to the message
// loop being pumped.
@@ -42,42 +44,73 @@ class GPUInfo {
// Device ids are unique to vendor, not to one another.
uint32 device_id() const;
+ // Return the vendor of the graphics driver currently installed.
+ std::string driver_vendor() const;
+
// Return the version of the graphics driver currently installed.
- // This will typically be something
- std::wstring driver_version() const;
+ std::string driver_version() const;
// Return the version of the pixel/fragment shader used by the gpu.
- // This will typically be a number less than 10 so storing as a float
- // should be okay.
+ // Major version in the second lowest 8 bits, minor in the lowest 8 bits,
+ // eg version 2.5 would be 0x00000205.
uint32 pixel_shader_version() const;
// Return the version of the vertex shader used by the gpu.
- // This will typically be a number less than 10 so storing as a float
- // should be okay.
+ // Major version in the second lowest 8 bits, minor in the lowest 8 bits,
+ // eg version 2.5 would be 0x00000205.
uint32 vertex_shader_version() const;
// Return the version of OpenGL we are using.
- // Major version in the high word, minor in the low word, eg version 2.5
- // would be 0x00020005.
+ // Major version in the second lowest 8 bits, minor in the lowest 8 bits,
+ // eg version 2.5 would be 0x00000205.
// Returns 0 if we're not using OpenGL, say because we're going through
// D3D instead.
+ // TODO(zmo): should be able to tell if it's GL or GLES.
uint32 gl_version() const;
+ // Return the GL_VERSION string.
+ // Return "" if we are not using OpenGL.
+ std::string gl_version_string() const;
+
+ // Return the GL_VENDOR string.
+ // Return "" if we are not using OpenGL.
+ std::string gl_vendor() const;
+
+ // Return the GL_RENDERER string.
+ // Return "" if we are not using OpenGL.
+ std::string gl_renderer() const;
+
+ // Return the GL_EXTENSIONS string.
+ // Return "" if we are not using OpenGL.
+ std::string gl_extensions() const;
+
// Return the device semantics, i.e. whether the Vista and Windows 7 specific
// semantics are available.
bool can_lose_context() const;
- void SetProgress(Progress progress);
+ void SetLevel(Level level);
void SetInitializationTime(const base::TimeDelta& initialization_time);
- // Populate variables with passed in values
- void SetGraphicsInfo(uint32 vendor_id, uint32 device_id,
- const std::wstring& driver_version,
- uint32 pixel_shader_version,
- uint32 vertex_shader_version,
- uint32 gl_version,
- bool can_lose_context);
+ void SetVideoCardInfo(uint32 vendor_id, uint32 device_id);
+
+ void SetDriverInfo(const std::string& driver_vendor,
+ const std::string& driver_version);
+
+ void SetShaderVersion(uint32 pixel_shader_version,
+ uint32 vertex_shader_version);
+
+ void SetGLVersion(uint32 gl_version);
+
+ void SetGLVersionString(const std::string& gl_vendor_string);
+
+ void SetGLVendor(const std::string& gl_vendor);
+
+ void SetGLRenderer(const std::string& gl_renderer);
+
+ void SetGLExtensions(const std::string& gl_extensions);
+
+ void SetCanLoseContext(bool can_lose_context);
#if defined(OS_WIN)
// The information returned by the DirectX Diagnostics Tool.
@@ -87,14 +120,19 @@ class GPUInfo {
#endif
private:
- Progress progress_;
+ Level level_;
base::TimeDelta initialization_time_;
uint32 vendor_id_;
uint32 device_id_;
- std::wstring driver_version_;
+ std::string driver_vendor_;
+ std::string driver_version_;
uint32 pixel_shader_version_;
uint32 vertex_shader_version_;
uint32 gl_version_;
+ std::string gl_version_string_;
+ std::string gl_vendor_;
+ std::string gl_renderer_;
+ std::string gl_extensions_;
bool can_lose_context_;
#if defined(OS_WIN)