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/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);