diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 16:45:23 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 16:45:23 +0000 |
commit | 76665309ae2f9acc2f7803efd66d08e92ee047b3 (patch) | |
tree | 3be60d9049cfd4a1ba6c5843f249f1a352601333 /chrome | |
parent | 59d3a18a58f0e3b1e56bfbfcf398f19826742e21 (diff) | |
download | chromium_src-76665309ae2f9acc2f7803efd66d08e92ee047b3.zip chromium_src-76665309ae2f9acc2f7803efd66d08e92ee047b3.tar.gz chromium_src-76665309ae2f9acc2f7803efd66d08e92ee047b3.tar.bz2 |
Collect D3D Driver Info (version and date) from Windows system registry.
BUG=72977
TEST=about:gpu page display driver version and date in Windows.
Review URL: http://codereview.chromium.org/6588027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/webui/gpu_internals_ui.cc | 2 | ||||
-rw-r--r-- | chrome/common/gpu_info.cc | 16 | ||||
-rw-r--r-- | chrome/common/gpu_info.h | 7 | ||||
-rw-r--r-- | chrome/common/gpu_info_unittest.cc | 1 | ||||
-rw-r--r-- | chrome/common/gpu_messages.cc | 8 | ||||
-rw-r--r-- | chrome/common/gpu_messages_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector.cc | 2 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector.h | 7 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_linux.cc | 4 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_mac.mm | 4 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_win.cc | 139 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_unittest_win.cc | 23 |
13 files changed, 159 insertions, 62 deletions
diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc index dd976bb..ca85bec 100644 --- a/chrome/browser/ui/webui/gpu_internals_ui.cc +++ b/chrome/browser/ui/webui/gpu_internals_ui.cc @@ -322,6 +322,8 @@ DictionaryValue* GpuInfoToDict(const GPUInfo& gpu_info) { gpu_info.driver_vendor())); basic_info->Append(NewDescriptionValuePair("Driver version", gpu_info.driver_version())); + basic_info->Append(NewDescriptionValuePair("Driver date", + gpu_info.driver_date())); basic_info->Append(NewDescriptionValuePair("Pixel shader version", VersionNumberToString(gpu_info.pixel_shader_version()))); basic_info->Append(NewDescriptionValuePair("Vertex shader version", diff --git a/chrome/common/gpu_info.cc b/chrome/common/gpu_info.cc index 171aa65..07b2461 100644 --- a/chrome/common/gpu_info.cc +++ b/chrome/common/gpu_info.cc @@ -10,6 +10,7 @@ GPUInfo::GPUInfo() device_id_(0), driver_vendor_(""), driver_version_(""), + driver_date_(""), pixel_shader_version_(0), vertex_shader_version_(0), gl_version_(0), @@ -47,6 +48,10 @@ std::string GPUInfo::driver_version() const { return driver_version_; } +std::string GPUInfo::driver_date() const { + return driver_date_; +} + uint32 GPUInfo::pixel_shader_version() const { return pixel_shader_version_; } @@ -98,9 +103,14 @@ void GPUInfo::SetVideoCardInfo(uint32 vendor_id, uint32 device_id) { } void GPUInfo::SetDriverInfo(const std::string& driver_vendor, - const std::string& driver_version) { - driver_vendor_ = driver_vendor; - driver_version_ = driver_version; + const std::string& driver_version, + const std::string& driver_date) { + if (driver_vendor.length() > 0) + driver_vendor_ = driver_vendor; + if (driver_version.length() > 0) + driver_version_ = driver_version; + if (driver_date.length() > 0) + driver_date_ = driver_date; } void GPUInfo::SetShaderVersion(uint32 pixel_shader_version, diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h index 9f751ef..f23c817 100644 --- a/chrome/common/gpu_info.h +++ b/chrome/common/gpu_info.h @@ -50,6 +50,9 @@ class GPUInfo { // Return the version of the graphics driver currently installed. std::string driver_version() const; + // Return the date of the graphics driver currently installed. + std::string driver_date() const; + // Return the version of the pixel/fragment shader used by the gpu. // Major version in the second lowest 8 bits, minor in the lowest 8 bits, // eg version 2.5 would be 0x00000205. @@ -100,7 +103,8 @@ class GPUInfo { void SetVideoCardInfo(uint32 vendor_id, uint32 device_id); void SetDriverInfo(const std::string& driver_vendor, - const std::string& driver_version); + const std::string& driver_version, + const std::string& driver_date); void SetShaderVersion(uint32 pixel_shader_version, uint32 vertex_shader_version); @@ -133,6 +137,7 @@ class GPUInfo { uint32 device_id_; std::string driver_vendor_; std::string driver_version_; + std::string driver_date_; uint32 pixel_shader_version_; uint32 vertex_shader_version_; uint32 gl_version_; diff --git a/chrome/common/gpu_info_unittest.cc b/chrome/common/gpu_info_unittest.cc index 34630e8..c1a5dce 100644 --- a/chrome/common/gpu_info_unittest.cc +++ b/chrome/common/gpu_info_unittest.cc @@ -14,6 +14,7 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) { EXPECT_EQ(gpu_info.device_id(), 0u); EXPECT_EQ(gpu_info.driver_vendor(), ""); EXPECT_EQ(gpu_info.driver_version(), ""); + EXPECT_EQ(gpu_info.driver_date(), ""); EXPECT_EQ(gpu_info.pixel_shader_version(), 0u); EXPECT_EQ(gpu_info.vertex_shader_version(), 0u); EXPECT_EQ(gpu_info.gl_version(), 0u); diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index b46babe..a5b1550 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -134,6 +134,7 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { WriteParam(m, p.device_id()); WriteParam(m, p.driver_vendor()); WriteParam(m, p.driver_version()); + WriteParam(m, p.driver_date()); WriteParam(m, p.pixel_shader_version()); WriteParam(m, p.vertex_shader_version()); WriteParam(m, p.gl_version()); @@ -155,6 +156,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { uint32 device_id; std::string driver_vendor; std::string driver_version; + std::string driver_date; uint32 pixel_shader_version; uint32 vertex_shader_version; uint32 gl_version; @@ -169,6 +171,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { ret = ret && ReadParam(m, iter, &device_id); ret = ret && ReadParam(m, iter, &driver_vendor); ret = ret && ReadParam(m, iter, &driver_version); + ret = ret && ReadParam(m, iter, &driver_date); ret = ret && ReadParam(m, iter, &pixel_shader_version); ret = ret && ReadParam(m, iter, &vertex_shader_version); ret = ret && ReadParam(m, iter, &gl_version); @@ -183,7 +186,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { p->SetInitializationTime(initialization_time); p->SetVideoCardInfo(vendor_id, device_id); - p->SetDriverInfo(driver_vendor, driver_version); + p->SetDriverInfo(driver_vendor, driver_version, driver_date); p->SetShaderVersion(pixel_shader_version, vertex_shader_version); p->SetGLVersion(gl_version); p->SetGLVersionString(gl_version_string); @@ -204,7 +207,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { } void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { - l->append(base::StringPrintf("<GPUInfo> %d %d %x %x %s %s %x %x %x %d", + l->append(base::StringPrintf("<GPUInfo> %d %d %x %x %s %s %s %x %x %x %d", p.level(), static_cast<int32>( p.initialization_time().InMilliseconds()), @@ -212,6 +215,7 @@ void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { p.device_id(), p.driver_vendor().c_str(), p.driver_version().c_str(), + p.driver_date().c_str(), p.pixel_shader_version(), p.vertex_shader_version(), p.gl_version(), diff --git a/chrome/common/gpu_messages_unittest.cc b/chrome/common/gpu_messages_unittest.cc index 4e2da79..1177033 100644 --- a/chrome/common/gpu_messages_unittest.cc +++ b/chrome/common/gpu_messages_unittest.cc @@ -16,7 +16,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { input.SetLevel(GPUInfo::kPartial); input.SetInitializationTime(base::TimeDelta::FromMilliseconds(100)); input.SetVideoCardInfo(0x10de, 0x0658); - input.SetDriverInfo("NVIDIA", "195.36.24"); + input.SetDriverInfo("NVIDIA", "195.36.24", "7-14-2009"); input.SetShaderVersion(0x0162, 0x0162); input.SetGLVersion(0x0302); input.SetGLVersionString("3.2.0 NVIDIA 195.36.24"); @@ -38,6 +38,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { EXPECT_EQ(input.device_id(), output.device_id()); EXPECT_EQ(input.driver_vendor(), output.driver_vendor()); EXPECT_EQ(input.driver_version(), output.driver_version()); + EXPECT_EQ(input.driver_date(), output.driver_date()); EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); EXPECT_EQ(input.gl_version(), output.gl_version()); @@ -49,6 +50,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { std::string log_message; IPC::LogParam(output, &log_message); - EXPECT_STREQ("<GPUInfo> 1 100 10de 658 NVIDIA 195.36.24 162 162 302 0", + EXPECT_STREQ("<GPUInfo> 1 100 10de 658 NVIDIA " + "195.36.24 7-14-2009 162 162 302 0", log_message.c_str()); } diff --git a/chrome/gpu/gpu_info_collector.cc b/chrome/gpu/gpu_info_collector.cc index f6936fd..acaa6e5 100644 --- a/chrome/gpu/gpu_info_collector.cc +++ b/chrome/gpu/gpu_info_collector.cc @@ -93,7 +93,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { bool validGLVersionInfo = CollectGLVersionInfo(gpu_info); bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); - bool validDriverInfo = CollectDriverInfo(gpu_info); + bool validDriverInfo = CollectDriverInfoGL(gpu_info); FinalizeGLContext(&context); diff --git a/chrome/gpu/gpu_info_collector.h b/chrome/gpu/gpu_info_collector.h index 9dab03e..a95a525 100644 --- a/chrome/gpu/gpu_info_collector.h +++ b/chrome/gpu/gpu_info_collector.h @@ -32,6 +32,11 @@ bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info); // A D3D argument is passed in for testing purposes bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info); +// Collects D3D driver version/date through registry lookup. +// Note that this does not require a D3D context. +// device_id here is the raw data in DISPLAY_DEVICE. +bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info); + // Collect the DirectX Disagnostics information about the attached displays. bool GetDxDiagnostics(DxDiagNode* output); #endif @@ -46,7 +51,7 @@ bool CollectGLVersionInfo(GPUInfo* gpu_info); bool CollectVideoCardInfo(GPUInfo* gpu_info); // Each platform stores the driver version on the GL_VERSION string differently -bool CollectDriverInfo(GPUInfo* gpu_info); +bool CollectDriverInfoGL(GPUInfo* gpu_info); } // namespace gpu_info_collector diff --git a/chrome/gpu/gpu_info_collector_linux.cc b/chrome/gpu/gpu_info_collector_linux.cc index 63f4d34..cebcf20 100644 --- a/chrome/gpu/gpu_info_collector_linux.cc +++ b/chrome/gpu/gpu_info_collector_linux.cc @@ -232,7 +232,7 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { return (gpu_active != NULL); } -bool CollectDriverInfo(GPUInfo* gpu_info) { +bool CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); std::string gl_version_string = gpu_info->gl_version_string(); @@ -250,7 +250,7 @@ bool CollectDriverInfo(GPUInfo* gpu_info) { if (pos != std::string::npos) driver_version = driver_version.substr(0, pos); - gpu_info->SetDriverInfo(pieces[1], driver_version); + gpu_info->SetDriverInfo(pieces[1], driver_version, ""); return true; } diff --git a/chrome/gpu/gpu_info_collector_mac.mm b/chrome/gpu/gpu_info_collector_mac.mm index 38e10bb..e4581bf 100644 --- a/chrome/gpu/gpu_info_collector_mac.mm +++ b/chrome/gpu/gpu_info_collector_mac.mm @@ -84,7 +84,7 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { return true; } -bool CollectDriverInfo(GPUInfo* gpu_info) { +bool CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); // Extract the OpenGL driver version string from the GL_VERSION string. @@ -95,7 +95,7 @@ bool CollectDriverInfo(GPUInfo* gpu_info) { size_t pos = gl_version_string.find_last_of('-'); if (pos == std::string::npos) return false; - gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1)); + gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1), ""); return true; } diff --git a/chrome/gpu/gpu_info_collector_unittest.cc b/chrome/gpu/gpu_info_collector_unittest.cc index 09282f7..e3f625f 100644 --- a/chrome/gpu/gpu_info_collector_unittest.cc +++ b/chrome/gpu/gpu_info_collector_unittest.cc @@ -66,7 +66,7 @@ class GPUInfoCollectorTest : public testing::Test { "GL_EXT_read_format_bgra"; #endif test_values_.SetVideoCardInfo(vendor_id, device_id); - test_values_.SetDriverInfo(driver_vendor, driver_version); + test_values_.SetDriverInfo(driver_vendor, driver_version, ""); test_values_.SetShaderVersion(shader_version, shader_version); test_values_.SetGLVersion(gl_version); test_values_.SetGLRenderer(gl_renderer); diff --git a/chrome/gpu/gpu_info_collector_win.cc b/chrome/gpu/gpu_info_collector_win.cc index d919efe..6f5fa19 100644 --- a/chrome/gpu/gpu_info_collector_win.cc +++ b/chrome/gpu/gpu_info_collector_win.cc @@ -4,8 +4,9 @@ #include "chrome/gpu/gpu_info_collector.h" -#include <windows.h> #include <d3d9.h> +#include <setupapi.h> +#include <windows.h> #include "app/gfx/gl/gl_context_egl.h" #include "app/gfx/gl/gl_implementation.h" @@ -19,6 +20,31 @@ #include "libEGL/main.h" #include "libEGL/Display.h" +// Setup API functions +typedef HDEVINFO (WINAPI*SetupDiGetClassDevsWFunc)( + CONST GUID *ClassGuid, + PCWSTR Enumerator, + HWND hwndParent, + DWORD Flags +); +typedef BOOL (WINAPI*SetupDiEnumDeviceInfoFunc)( + HDEVINFO DeviceInfoSet, + DWORD MemberIndex, + PSP_DEVINFO_DATA DeviceInfoData +); +typedef BOOL (WINAPI*SetupDiGetDeviceRegistryPropertyWFunc)( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + DWORD Property, + PDWORD PropertyRegDataType, + PBYTE PropertyBuffer, + DWORD PropertyBufferSize, + PDWORD RequiredSize +); +typedef BOOL (WINAPI*SetupDiDestroyDeviceInfoListFunc)( + HDEVINFO DeviceInfoSet +); + namespace gpu_info_collector { bool CollectGraphicsInfo(GPUInfo* gpu_info) { @@ -78,27 +104,7 @@ bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { DCHECK(d3d); DCHECK(gpu_info); - bool succeed = true; - - // Get device/driver information - D3DADAPTER_IDENTIFIER9 identifier; - if (d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &identifier) == D3D_OK) { - gpu_info->SetVideoCardInfo(identifier.VendorId, identifier.DeviceId); - - uint32 driver_major_version_hi = HIWORD(identifier.DriverVersion.HighPart); - uint32 driver_major_version_lo = LOWORD(identifier.DriverVersion.HighPart); - uint32 driver_minor_version_hi = HIWORD(identifier.DriverVersion.LowPart); - uint32 driver_minor_version_lo = LOWORD(identifier.DriverVersion.LowPart); - std::string driver_version = StringPrintf("%d.%d.%d.%d", - driver_major_version_hi, - driver_major_version_lo, - driver_minor_version_hi, - driver_minor_version_lo); - gpu_info->SetDriverInfo("", driver_version); - } else { - LOG(ERROR) << "d3d->GetAdapterIdentifier() failed"; - succeed = false; - } + bool succeed = CollectVideoCardInfo(gpu_info); // Get version information D3DCAPS9 d3d_caps; @@ -149,12 +155,97 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); base::HexStringToInt(WideToASCII(device_id_string), &device_id); gpu_info->SetVideoCardInfo(vendor_id, device_id); + // TODO(zmo): need a better way to identify if ANGLE is used. + if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) + return CollectDriverInfoD3D(id, gpu_info); return true; } return false; } -bool CollectDriverInfo(GPUInfo* gpu_info) { +bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info) { + HMODULE lib_setupapi = LoadLibraryW(L"setupapi.dll"); + if (!lib_setupapi) { + LOG(ERROR) << "Open setupapi.dll failed"; + return false; + } + SetupDiGetClassDevsWFunc fp_get_class_devs = + reinterpret_cast<SetupDiGetClassDevsWFunc>( + GetProcAddress(lib_setupapi, "SetupDiGetClassDevsW")); + SetupDiEnumDeviceInfoFunc fp_enum_device_info = + reinterpret_cast<SetupDiEnumDeviceInfoFunc>( + GetProcAddress(lib_setupapi, "SetupDiEnumDeviceInfo")); + SetupDiGetDeviceRegistryPropertyWFunc fp_get_device_registry_property = + reinterpret_cast<SetupDiGetDeviceRegistryPropertyWFunc>( + GetProcAddress(lib_setupapi, "SetupDiGetDeviceRegistryPropertyW")); + SetupDiDestroyDeviceInfoListFunc fp_destroy_device_info_list = + reinterpret_cast<SetupDiDestroyDeviceInfoListFunc>( + GetProcAddress(lib_setupapi, "SetupDiDestroyDeviceInfoList")); + if (!fp_get_class_devs || !fp_enum_device_info || + !fp_get_device_registry_property || !fp_destroy_device_info_list) { + FreeLibrary(lib_setupapi); + LOG(ERROR) << "Retrieve setupapi.dll functions failed"; + return false; + } + + // create device info for the display device + HDEVINFO device_info = fp_get_class_devs( + NULL, device_id.c_str(), NULL, + DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES); + if (device_info == INVALID_HANDLE_VALUE) { + FreeLibrary(lib_setupapi); + LOG(ERROR) << "Creating device info failed"; + return false; + } + + DWORD index = 0; + bool found = false; + SP_DEVINFO_DATA device_info_data; + device_info_data.cbSize = sizeof(device_info_data); + while (fp_enum_device_info(device_info, index++, &device_info_data)) { + WCHAR value[255]; + if (fp_get_device_registry_property(device_info, + &device_info_data, + SPDRP_DRIVER, + NULL, + reinterpret_cast<PBYTE>(value), + sizeof(value), + NULL)) { + HKEY key; + std::wstring driver_key = L"System\\CurrentControlSet\\Control\\Class\\"; + driver_key += value; + LONG result = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, driver_key.c_str(), 0, KEY_QUERY_VALUE, &key); + if (result == ERROR_SUCCESS) { + DWORD dwcb_data = sizeof(value); + std::string driver_version; + result = RegQueryValueExW( + key, L"DriverVersion", NULL, NULL, + reinterpret_cast<LPBYTE>(value), &dwcb_data); + if (result == ERROR_SUCCESS) + driver_version = WideToASCII(std::wstring(value)); + + std::string driver_date; + dwcb_data = sizeof(value); + result = RegQueryValueExW( + key, L"DriverDate", NULL, NULL, + reinterpret_cast<LPBYTE>(value), &dwcb_data); + if (result == ERROR_SUCCESS) + driver_date = WideToASCII(std::wstring(value)); + + gpu_info->SetDriverInfo("", driver_version, driver_date); + found = true; + RegCloseKey(key); + break; + } + } + } + fp_destroy_device_info_list(device_info); + FreeLibrary(lib_setupapi); + return found; +} + +bool CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); std::string gl_version_string = gpu_info->gl_version_string(); @@ -164,7 +255,7 @@ bool CollectDriverInfo(GPUInfo* gpu_info) { size_t pos = gl_version_string.find_last_not_of("0123456789."); if (pos != std::string::npos && pos < gl_version_string.length() - 1) { - gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1)); + gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1), ""); return true; } return false; diff --git a/chrome/gpu/gpu_info_unittest_win.cc b/chrome/gpu/gpu_info_unittest_win.cc index 21c9ef4..aa8a1e2 100644 --- a/chrome/gpu/gpu_info_unittest_win.cc +++ b/chrome/gpu/gpu_info_unittest_win.cc @@ -27,9 +27,6 @@ class GPUInfoTest : public testing::Test { test_caps_.PixelShaderVersion = 0xffff0300; // 3.0 test_caps_.VertexShaderVersion = 0xfffe0300; // 3.0 - EXPECT_CALL(d3d_, GetAdapterIdentifier(_, _, _)) - .WillOnce(DoAll(SetArgumentPointee<2>(test_identifier_), - Return(D3D_OK))); EXPECT_CALL(d3d_, GetDeviceCaps(_, _, _)) .WillOnce(DoAll(SetArgumentPointee<2>(test_caps_), Return(D3D_OK))); @@ -47,26 +44,6 @@ class GPUInfoTest : public testing::Test { D3DCAPS9 test_caps_; }; -TEST_F(GPUInfoTest, VendorIdD3D) { - GPUInfo gpu_info; - ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - EXPECT_EQ(gpu_info.vendor_id(), 0x10de); -} - -TEST_F(GPUInfoTest, DeviceIdD3D) { - GPUInfo gpu_info; - ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - EXPECT_EQ(gpu_info.device_id(), 0x429); -} - -TEST_F(GPUInfoTest, DriverVersionD3D) { - GPUInfo gpu_info; - ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - std::string driver_version = gpu_info.driver_version(); - EXPECT_FALSE(driver_version.empty()); - EXPECT_EQ(driver_version, "6.14.11.7715"); -} - TEST_F(GPUInfoTest, PixelShaderVersionD3D) { GPUInfo gpu_info; ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); |