summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/common/gpu_info.cc49
-rw-r--r--content/common/gpu_info.h8
2 files changed, 57 insertions, 0 deletions
diff --git a/content/common/gpu_info.cc b/content/common/gpu_info.cc
index 50e227e..6b4d0a7 100644
--- a/content/common/gpu_info.cc
+++ b/content/common/gpu_info.cc
@@ -12,3 +12,52 @@ GPUInfo::GPUInfo()
}
GPUInfo::~GPUInfo() { }
+
+bool GPUInfo::Merge(const GPUInfo& other) {
+ if (device_id != other.device_id || vendor_id != other.vendor_id) {
+ *this = other;
+ return true;
+ }
+
+ bool changed = false;
+ if (!finalized) {
+ finalized = other.finalized;
+ initialization_time = other.initialization_time;
+ if (driver_vendor.empty() && !other.driver_vendor.empty()) {
+ driver_vendor = other.driver_vendor;
+ changed = true;
+ }
+ if (driver_version.empty() && !other.driver_version.empty()) {
+ driver_version = other.driver_version;
+ changed = true;
+ }
+ if (driver_date.empty() && !other.driver_date.empty()) {
+ driver_date = other.driver_date;
+ changed = true;
+ }
+ if (pixel_shader_version.empty())
+ pixel_shader_version = other.pixel_shader_version;
+ if (vertex_shader_version.empty())
+ vertex_shader_version = other.vertex_shader_version;
+ if (gl_version.empty())
+ gl_version = other.gl_version;
+ if (gl_version_string.empty())
+ gl_version_string = other.gl_version_string;
+ if (gl_vendor.empty())
+ gl_vendor = other.gl_vendor;
+ if (gl_renderer.empty() && !other.gl_renderer.empty()) {
+ gl_renderer = other.gl_renderer;
+ changed = true;
+ }
+ if (gl_extensions.empty())
+ gl_extensions = other.gl_extensions;
+ can_lose_context = other.can_lose_context;
+#if defined(OS_WIN)
+ if (dx_diagnostics.values.size() == 0 &&
+ dx_diagnostics.children.size() == 0)
+ dx_diagnostics = other.dx_diagnostics;
+#endif
+ }
+ return changed;
+}
+
diff --git a/content/common/gpu_info.h b/content/common/gpu_info.h
index c014e09..402535e 100644
--- a/content/common/gpu_info.h
+++ b/content/common/gpu_info.h
@@ -20,6 +20,14 @@ struct GPUInfo {
GPUInfo();
~GPUInfo();
+ // If it's the same GPU, i.e., device id and vendor id are the same, then
+ // copy over the fields that are not set yet and ignore the rest.
+ // If it's a different GPU, then reset and copy over everything.
+ // Return true if something changes that may affect blacklisting; currently
+ // they are device_id, vendor_id, driver_vendor, driver_version, driver_date,
+ // and gl_renderer.
+ bool Merge(const GPUInfo& other);
+
// Whether more GPUInfo fields might be collected in the future.
bool finalized;