vulkan: ignore device-only layers

Ignore device layers that have no matching instance layers.

Change-Id: I6460f8f0c3c1288c23843e0875fa6a90f7f6cb8d
diff --git a/vulkan/libvulkan/layers_extensions.cpp b/vulkan/libvulkan/layers_extensions.cpp
index e861ffe..be0a3ee 100644
--- a/vulkan/libvulkan/layers_extensions.cpp
+++ b/vulkan/libvulkan/layers_extensions.cpp
@@ -226,16 +226,21 @@
 
         instance_layers.push_back(layer);
         ALOGV("  added instance layer '%s'", props.layerName);
-    }
-    for (size_t i = 0; i < num_device_layers; i++) {
-        const VkLayerProperties& props = properties[num_instance_layers + i];
 
-        Layer layer;
-        layer.properties = props;
-        layer.library_idx = library_idx;
+        bool is_global = false;
+        for (size_t j = 0; j < num_device_layers; j++) {
+            const auto& dev_props = properties[num_instance_layers + j];
+            if (memcmp(&props, &dev_props, sizeof(props)) == 0) {
+                is_global = true;
+                break;
+            }
+        }
 
+        if (!is_global)
+            continue;
+
+        layer.extensions.clear();
         if (enumerate_device_extensions) {
-            uint32_t count;
             result = enumerate_device_extensions(
                 VK_NULL_HANDLE, props.layerName, &count, nullptr);
             if (result != VK_SUCCESS) {