OSDN Git Service

vulkan: ignore device-only layers
authorChia-I Wu <olv@google.com>
Mon, 18 Apr 2016 08:45:15 +0000 (16:45 +0800)
committerChia-I Wu <olv@google.com>
Mon, 25 Apr 2016 23:43:46 +0000 (07:43 +0800)
Ignore device layers that have no matching instance layers.

Change-Id: I6460f8f0c3c1288c23843e0875fa6a90f7f6cb8d

vulkan/libvulkan/layers_extensions.cpp

index e861ffe..be0a3ee 100644 (file)
@@ -226,16 +226,21 @@ bool LayerLibrary::EnumerateLayers(size_t library_idx,
 
         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) {