chassis: Kill duplicate extension-enabled tracking

DeviceExtension struct had two duplicate mechanisms for tracking
enabled device extensions. Removed the less useful one.

Change-Id: I57e824d2342fe4a9504bf44b75e58c0905044442
diff --git a/layers/generated/chassis.cpp b/layers/generated/chassis.cpp
index b098477..e90e39c 100644
--- a/layers/generated/chassis.cpp
+++ b/layers/generated/chassis.cpp
@@ -330,7 +330,7 @@
 
 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
     auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map);
-    if (!ApiParentExtensionEnabled(funcName, layer_data->device_extensions.device_extension_set)) {
+    if (!ApiParentExtensionEnabled(funcName, &layer_data->device_extensions)) {
         return nullptr;
     }
     const auto &item = name_to_funcptr_map.find(funcName);
diff --git a/layers/generated/vk_dispatch_table_helper.h b/layers/generated/vk_dispatch_table_helper.h
index 5912746..5c2f540 100644
--- a/layers/generated/vk_dispatch_table_helper.h
+++ b/layers/generated/vk_dispatch_table_helper.h
@@ -31,6 +31,7 @@
 #include <unordered_set>
 #include <unordered_map>
 #include "vk_layer_dispatch_table.h"
+#include "vk_extension_helper.h"
 
 static VKAPI_ATTR VkResult VKAPI_CALL StubBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) { return VK_SUCCESS; };
 static VKAPI_ATTR VkResult VKAPI_CALL StubBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) { return VK_SUCCESS; };
@@ -352,12 +353,13 @@
 //   o  Determine if the API has an associated extension
 //   o  If it does, determine if that extension name is present in the passed-in set of enabled_ext_names 
 //   If the APIname has no parent extension, OR its parent extension name is IN the set, return TRUE, else FALSE
-static inline bool ApiParentExtensionEnabled(const std::string api_name, const std::unordered_set<std::string> &enabled_ext_names) {
+static inline bool ApiParentExtensionEnabled(const std::string api_name, const DeviceExtensions *device_extension_info) {
     auto has_ext = api_extension_map.find(api_name);
-    // Is this API part of an extension?
+    // Is this API part of an extension or feature group?
     if (has_ext != api_extension_map.end()) {
         // Was the extension for this API enabled in the CreateDevice call?
-        if (enabled_ext_names.find(has_ext->second) == enabled_ext_names.end()) {
+        auto info = device_extension_info->get_info(has_ext->second.c_str());
+        if ((!info.state) || (device_extension_info->*(info.state) != true)) {
             return false;
         }
     }
diff --git a/layers/generated/vk_extension_helper.h b/layers/generated/vk_extension_helper.h
index e67f892..8071b98 100644
--- a/layers/generated/vk_extension_helper.h
+++ b/layers/generated/vk_extension_helper.h
@@ -37,6 +37,7 @@
 #include <unordered_map>
 #include <utility>
 #include <set>
+#include <vector>
 
 #include <vulkan/vulkan.h>
 
@@ -73,8 +74,6 @@
     bool vk_nn_vi_surface{false};
     bool vk_nv_external_memory_capabilities{false};
 
-    std::unordered_set<std::string> device_extension_set;
-
     struct InstanceReq {
         const bool InstanceExtensions::* enabled;
         const char *name;
@@ -184,11 +183,6 @@
 
     uint32_t InitFromInstanceCreateInfo(uint32_t requested_api_version, const VkInstanceCreateInfo *pCreateInfo) {
 
-        // Save pCreateInfo device extension list
-        for (uint32_t extn = 0; extn < pCreateInfo->enabledExtensionCount; extn++) {
-           device_extension_set.insert(pCreateInfo->ppEnabledExtensionNames[extn]);
-        }
-
         static const std::vector<const char *> V_1_0_promoted_instance_extensions = {
             VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME,
             VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME,
@@ -721,11 +715,6 @@
         *this = DeviceExtensions(*instance_extensions);
 
 
-        // Save pCreateInfo device extension list
-        for (uint32_t extn = 0; extn < pCreateInfo->enabledExtensionCount; extn++) {
-           device_extension_set.insert(pCreateInfo->ppEnabledExtensionNames[extn]);
-        }
-
         static const std::vector<const char *> V_1_0_promoted_device_extensions = {
             VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
             VK_KHR_BIND_MEMORY_2_EXTENSION_NAME,
diff --git a/scripts/dispatch_table_helper_generator.py b/scripts/dispatch_table_helper_generator.py
index 8d202c9..5aaf8ed 100644
--- a/scripts/dispatch_table_helper_generator.py
+++ b/scripts/dispatch_table_helper_generator.py
@@ -123,6 +123,7 @@
         preamble += '#include <unordered_set>\n'
         preamble += '#include <unordered_map>\n'
         preamble += '#include "vk_layer_dispatch_table.h"\n'
+        preamble += '#include "vk_extension_helper.h"\n'
 
         write(copyright, file=self.outFile)
         write(preamble, file=self.outFile)
@@ -231,12 +232,13 @@
         ext_fcn += '//   o  Determine if the API has an associated extension\n'
         ext_fcn += '//   o  If it does, determine if that extension name is present in the passed-in set of enabled_ext_names \n'
         ext_fcn += '//   If the APIname has no parent extension, OR its parent extension name is IN the set, return TRUE, else FALSE\n'
-        ext_fcn += 'static inline bool ApiParentExtensionEnabled(const std::string api_name, const std::unordered_set<std::string> &enabled_ext_names) {\n'
+        ext_fcn += 'static inline bool ApiParentExtensionEnabled(const std::string api_name, const DeviceExtensions *device_extension_info) {\n'
         ext_fcn += '    auto has_ext = api_extension_map.find(api_name);\n'
-        ext_fcn += '    // Is this API part of an extension?\n'
+        ext_fcn += '    // Is this API part of an extension or feature group?\n'
         ext_fcn += '    if (has_ext != api_extension_map.end()) {\n'
         ext_fcn += '        // Was the extension for this API enabled in the CreateDevice call?\n'
-        ext_fcn += '        if (enabled_ext_names.find(has_ext->second) == enabled_ext_names.end()) {\n'
+        ext_fcn += '        auto info = device_extension_info->get_info(has_ext->second.c_str());\n'
+        ext_fcn += '        if ((!info.state) || (device_extension_info->*(info.state) != true)) {\n'
         ext_fcn += '            return false;\n'
         ext_fcn += '        }\n'
         ext_fcn += '    }\n'
diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py
index 759bf1b..ef3810d 100644
--- a/scripts/helper_file_generator.py
+++ b/scripts/helper_file_generator.py
@@ -526,6 +526,7 @@
             '#include <unordered_map>',
             '#include <utility>',
             '#include <set>',
+            '#include <vector>',
             '',
             '#include <vulkan/vulkan.h>',
             '']
@@ -564,12 +565,6 @@
             struct  = [struct_decl]
             struct.extend([ '    bool %s{false};' % field_name[ext_name] for ext_name, info in extension_items])
 
-            # Create struct entries for saving extension count and extension list from Instance, DeviceCreateInfo
-            if type == 'Instance':
-                struct.extend([
-                    '',
-                    '    std::unordered_set<std::string> device_extension_set;'])
-
             # Construct the extension information map -- mapping name to data member (field), and required extensions
             # The map is contained within a static function member for portability reasons.
             info_type = '%sInfo' % type
@@ -635,11 +630,6 @@
                     '        *this = %s(*instance_extensions);' % struct_type,
                     '']),
             struct.extend([
-                    '',
-                    '        // Save pCreateInfo device extension list',
-                    '        for (uint32_t extn = 0; extn < pCreateInfo->enabledExtensionCount; extn++) {',
-                    '           device_extension_set.insert(pCreateInfo->ppEnabledExtensionNames[extn]);',
-                    '        }',
                 '',
                 '        static const std::vector<const char *> V_1_0_promoted_%s_extensions = {' % type.lower() ])
             struct.extend(['            %s_EXTENSION_NAME,' % ext_name.upper() for ext_name in promoted_ext_list])
diff --git a/scripts/layer_chassis_generator.py b/scripts/layer_chassis_generator.py
index d53ad4d..53c6d8e 100644
--- a/scripts/layer_chassis_generator.py
+++ b/scripts/layer_chassis_generator.py
@@ -723,7 +723,7 @@
 
 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
     auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map);
-    if (!ApiParentExtensionEnabled(funcName, layer_data->device_extensions.device_extension_set)) {
+    if (!ApiParentExtensionEnabled(funcName, &layer_data->device_extensions)) {
         return nullptr;
     }
     const auto &item = name_to_funcptr_map.find(funcName);