Commit 198ae6b4 authored by zmo@google.com's avatar zmo@google.com

Collect GL_EXTENSIONS string in GPUInfo and display it in about:gpu page.

(A second try after being reverted.)

Review URL: http://codereview.chromium.org/6279009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72445 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c66bce2
...@@ -295,6 +295,8 @@ DictionaryValue* GpuInfoToDict(const GPUInfo& gpu_info) { ...@@ -295,6 +295,8 @@ DictionaryValue* GpuInfoToDict(const GPUInfo& gpu_info) {
gpu_info.gl_renderer())); gpu_info.gl_renderer()));
basic_info->Append(NewDescriptionValuePair("GL_VERSION", basic_info->Append(NewDescriptionValuePair("GL_VERSION",
gpu_info.gl_version_string())); gpu_info.gl_version_string()));
basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS",
gpu_info.gl_extensions()));
DictionaryValue* info = new DictionaryValue(); DictionaryValue* info = new DictionaryValue();
info->Set("basic_info", basic_info); info->Set("basic_info", basic_info);
......
...@@ -16,6 +16,7 @@ GPUInfo::GPUInfo() ...@@ -16,6 +16,7 @@ GPUInfo::GPUInfo()
gl_version_string_(""), gl_version_string_(""),
gl_vendor_(""), gl_vendor_(""),
gl_renderer_(""), gl_renderer_(""),
gl_extensions_(""),
can_lose_context_(false) { can_lose_context_(false) {
} }
...@@ -67,6 +68,10 @@ std::string GPUInfo::gl_renderer() const { ...@@ -67,6 +68,10 @@ std::string GPUInfo::gl_renderer() const {
return gl_renderer_; return gl_renderer_;
} }
std::string GPUInfo::gl_extensions() const {
return gl_extensions_;
}
bool GPUInfo::can_lose_context() const { bool GPUInfo::can_lose_context() const {
return can_lose_context_; return can_lose_context_;
} }
...@@ -113,6 +118,10 @@ void GPUInfo::SetGLRenderer(const std::string& gl_renderer) { ...@@ -113,6 +118,10 @@ void GPUInfo::SetGLRenderer(const std::string& gl_renderer) {
gl_renderer_ = gl_renderer; gl_renderer_ = gl_renderer;
} }
void GPUInfo::SetGLExtensions(const std::string& gl_extensions) {
gl_extensions_ = gl_extensions;
}
void GPUInfo::SetCanLoseContext(bool can_lose_context) { void GPUInfo::SetCanLoseContext(bool can_lose_context) {
can_lose_context_ = can_lose_context; can_lose_context_ = can_lose_context;
} }
......
...@@ -79,6 +79,10 @@ class GPUInfo { ...@@ -79,6 +79,10 @@ class GPUInfo {
// Return "" if we are not using OpenGL. // Return "" if we are not using OpenGL.
std::string gl_renderer() const; 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 // Return the device semantics, i.e. whether the Vista and Windows 7 specific
// semantics are available. // semantics are available.
bool can_lose_context() const; bool can_lose_context() const;
...@@ -103,6 +107,8 @@ class GPUInfo { ...@@ -103,6 +107,8 @@ class GPUInfo {
void SetGLRenderer(const std::string& gl_renderer); void SetGLRenderer(const std::string& gl_renderer);
void SetGLExtensions(const std::string& gl_extensions);
void SetCanLoseContext(bool can_lose_context); void SetCanLoseContext(bool can_lose_context);
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -125,6 +131,7 @@ class GPUInfo { ...@@ -125,6 +131,7 @@ class GPUInfo {
std::string gl_version_string_; std::string gl_version_string_;
std::string gl_vendor_; std::string gl_vendor_;
std::string gl_renderer_; std::string gl_renderer_;
std::string gl_extensions_;
bool can_lose_context_; bool can_lose_context_;
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -20,5 +20,6 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) { ...@@ -20,5 +20,6 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) {
EXPECT_EQ(gpu_info.gl_version_string(), ""); EXPECT_EQ(gpu_info.gl_version_string(), "");
EXPECT_EQ(gpu_info.gl_vendor(), ""); EXPECT_EQ(gpu_info.gl_vendor(), "");
EXPECT_EQ(gpu_info.gl_renderer(), ""); EXPECT_EQ(gpu_info.gl_renderer(), "");
EXPECT_EQ(gpu_info.gl_extensions(), "");
EXPECT_EQ(gpu_info.can_lose_context(), false); EXPECT_EQ(gpu_info.can_lose_context(), false);
} }
...@@ -140,6 +140,7 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { ...@@ -140,6 +140,7 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) {
WriteParam(m, p.gl_version_string()); WriteParam(m, p.gl_version_string());
WriteParam(m, p.gl_vendor()); WriteParam(m, p.gl_vendor());
WriteParam(m, p.gl_renderer()); WriteParam(m, p.gl_renderer());
WriteParam(m, p.gl_extensions());
WriteParam(m, p.can_lose_context()); WriteParam(m, p.can_lose_context());
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -160,6 +161,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { ...@@ -160,6 +161,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
std::string gl_version_string; std::string gl_version_string;
std::string gl_vendor; std::string gl_vendor;
std::string gl_renderer; std::string gl_renderer;
std::string gl_extensions;
bool can_lose_context; bool can_lose_context;
bool ret = ReadParam(m, iter, &progress); bool ret = ReadParam(m, iter, &progress);
ret = ret && ReadParam(m, iter, &initialization_time); ret = ret && ReadParam(m, iter, &initialization_time);
...@@ -173,6 +175,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { ...@@ -173,6 +175,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
ret = ret && ReadParam(m, iter, &gl_version_string); ret = ret && ReadParam(m, iter, &gl_version_string);
ret = ret && ReadParam(m, iter, &gl_vendor); ret = ret && ReadParam(m, iter, &gl_vendor);
ret = ret && ReadParam(m, iter, &gl_renderer); ret = ret && ReadParam(m, iter, &gl_renderer);
ret = ret && ReadParam(m, iter, &gl_extensions);
ret = ret && ReadParam(m, iter, &can_lose_context); ret = ret && ReadParam(m, iter, &can_lose_context);
p->SetProgress(static_cast<GPUInfo::Progress>(progress)); p->SetProgress(static_cast<GPUInfo::Progress>(progress));
if (!ret) if (!ret)
...@@ -186,6 +189,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { ...@@ -186,6 +189,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
p->SetGLVersionString(gl_version_string); p->SetGLVersionString(gl_version_string);
p->SetGLVendor(gl_vendor); p->SetGLVendor(gl_vendor);
p->SetGLRenderer(gl_renderer); p->SetGLRenderer(gl_renderer);
p->SetGLExtensions(gl_extensions);
p->SetCanLoseContext(can_lose_context); p->SetCanLoseContext(can_lose_context);
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -22,6 +22,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { ...@@ -22,6 +22,7 @@ TEST(GPUIPCMessageTest, GPUInfo) {
input.SetGLVersionString("3.2.0 NVIDIA 195.36.24"); input.SetGLVersionString("3.2.0 NVIDIA 195.36.24");
input.SetGLVendor("NVIDIA Corporation"); input.SetGLVendor("NVIDIA Corporation");
input.SetGLRenderer("Quadro FX 380/PCI/SSE2"); input.SetGLRenderer("Quadro FX 380/PCI/SSE2");
input.SetGLExtensions("GL_ARB_texture_rg GL_ARB_window_pos");
input.SetCanLoseContext(false); input.SetCanLoseContext(false);
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
...@@ -43,6 +44,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { ...@@ -43,6 +44,7 @@ TEST(GPUIPCMessageTest, GPUInfo) {
EXPECT_EQ(input.gl_version_string(), output.gl_version_string()); EXPECT_EQ(input.gl_version_string(), output.gl_version_string());
EXPECT_EQ(input.gl_vendor(), output.gl_vendor()); EXPECT_EQ(input.gl_vendor(), output.gl_vendor());
EXPECT_EQ(input.gl_renderer(), output.gl_renderer()); EXPECT_EQ(input.gl_renderer(), output.gl_renderer());
EXPECT_EQ(input.gl_extensions(), output.gl_extensions());
EXPECT_EQ(input.can_lose_context(), output.can_lose_context()); EXPECT_EQ(input.can_lose_context(), output.can_lose_context());
std::string log_message; std::string log_message;
......
...@@ -89,6 +89,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { ...@@ -89,6 +89,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) {
gpu_info->SetGLRenderer(GetGLString(GL_RENDERER)); gpu_info->SetGLRenderer(GetGLString(GL_RENDERER));
gpu_info->SetGLVendor(GetGLString(GL_VENDOR)); gpu_info->SetGLVendor(GetGLString(GL_VENDOR));
gpu_info->SetGLVersionString(GetGLString(GL_VERSION)); gpu_info->SetGLVersionString(GetGLString(GL_VERSION));
gpu_info->SetGLExtensions(GetGLString(GL_EXTENSIONS));
bool validGLVersionInfo = CollectGLVersionInfo(gpu_info); bool validGLVersionInfo = CollectGLVersionInfo(gpu_info);
bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); bool validVideoCardInfo = CollectVideoCardInfo(gpu_info);
......
...@@ -33,6 +33,9 @@ class GPUInfoCollectorTest : public testing::Test { ...@@ -33,6 +33,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation"; const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "3.1.0"; const char* gl_version_string = "3.1.0";
const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler"; const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler";
const char* gl_extensions =
"GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
"GL_EXT_read_format_bgra";
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
const uint32 vendor_id = 0x10de; const uint32 vendor_id = 0x10de;
const uint32 device_id = 0x0640; const uint32 device_id = 0x0640;
...@@ -44,6 +47,9 @@ class GPUInfoCollectorTest : public testing::Test { ...@@ -44,6 +47,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation"; const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "2.1 NVIDIA-1.6.18"; const char* gl_version_string = "2.1 NVIDIA-1.6.18";
const char* gl_shading_language_version = "1.20 "; const char* gl_shading_language_version = "1.20 ";
const char* gl_extensions =
"GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
"GL_EXT_read_format_bgra";
#else // defined (OS_LINUX) #else // defined (OS_LINUX)
const uint32 vendor_id = 0x10de; const uint32 vendor_id = 0x10de;
const uint32 device_id = 0x0658; const uint32 device_id = 0x0658;
...@@ -55,6 +61,9 @@ class GPUInfoCollectorTest : public testing::Test { ...@@ -55,6 +61,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation"; const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "3.2.0 NVIDIA 195.36.24"; const char* gl_version_string = "3.2.0 NVIDIA 195.36.24";
const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler"; const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler";
const char* gl_extensions =
"GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
"GL_EXT_read_format_bgra";
#endif #endif
test_values_.SetVideoCardInfo(vendor_id, device_id); test_values_.SetVideoCardInfo(vendor_id, device_id);
test_values_.SetDriverInfo(driver_vendor, driver_version); test_values_.SetDriverInfo(driver_vendor, driver_version);
...@@ -63,12 +72,12 @@ class GPUInfoCollectorTest : public testing::Test { ...@@ -63,12 +72,12 @@ class GPUInfoCollectorTest : public testing::Test {
test_values_.SetGLRenderer(gl_renderer); test_values_.SetGLRenderer(gl_renderer);
test_values_.SetGLVendor(gl_vendor); test_values_.SetGLVendor(gl_vendor);
test_values_.SetGLVersionString(gl_version_string); test_values_.SetGLVersionString(gl_version_string);
test_values_.SetGLExtensions(gl_extensions);
test_values_.SetCanLoseContext(false); test_values_.SetCanLoseContext(false);
EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS)) EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS))
.WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>(
"GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " gl_extensions)));
"GL_EXT_read_format_bgra")));
EXPECT_CALL(*gl_, GetString(GL_SHADING_LANGUAGE_VERSION)) EXPECT_CALL(*gl_, GetString(GL_SHADING_LANGUAGE_VERSION))
.WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>(
gl_shading_language_version))); gl_shading_language_version)));
...@@ -153,3 +162,11 @@ TEST_F(GPUInfoCollectorTest, GLVendorGL) { ...@@ -153,3 +162,11 @@ TEST_F(GPUInfoCollectorTest, GLVendorGL) {
EXPECT_EQ(test_values_.gl_vendor(), gl_vendor); EXPECT_EQ(test_values_.gl_vendor(), gl_vendor);
} }
TEST_F(GPUInfoCollectorTest, GLExtensionsGL) {
GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
std::string gl_extensions = gpu_info.gl_extensions();
EXPECT_EQ(test_values_.gl_extensions(), gl_extensions);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment