diff options
author | John Zulauf <jzulauf@LunarG.com> | 2018-05-23 09:36:00 -0600 |
---|---|---|
committer | Tobin Ehlis <tobine@google.com> | 2018-05-24 07:29:17 -0600 |
commit | 0fe5bfe66443b288ccf19b3d4c523af7e080672c (patch) | |
tree | ea3c9658143df4f545fabe0ed668098c2632f655 /scripts | |
parent | 1238b27d41cd9d581040dba078b421875d881e5d (diff) | |
download | vulkan-validation-layers-0fe5bfe66443b288ccf19b3d4c523af7e080672c.tar.gz |
layers: Make validation error maps non-static
In order to address compile/runtime issues, the large validation tables
are now generated such that the declaration and implementation are
separate.
Change-Id: I3e9327e8d2c5427f2bfc93266cdfb8edc0339a12
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/spec.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/spec.py b/scripts/spec.py index 44a101c72..4eeb46aa3 100644 --- a/scripts/spec.py +++ b/scripts/spec.py @@ -202,8 +202,10 @@ class Specification: file_contents.append('// When a given error occurs, these enum values should be passed to the as the messageCode') file_contents.append('// parameter to the PFN_vkDebugReportCallbackEXT function') enum_decl = ['enum UNIQUE_VALIDATION_ERROR_CODE {\n VALIDATION_ERROR_UNDEFINED = -1,'] - vuid_int_to_error_map = ['static std::unordered_map<int, char const *const> validation_error_map{'] - vuid_string_to_error_map = ['static std::unordered_map<std::string, int> validation_error_text_map{'] + vuid_int_to_error_map_decl = 'std::unordered_map<int, char const *const> validation_error_map' + vuid_int_to_error_map = [ '#ifdef VALIDATION_ERROR_MAP_IMPL', vuid_int_to_error_map_decl + ' {'] + vuid_string_to_error_map_decl = 'std::unordered_map<std::string, int> validation_error_text_map' + vuid_string_to_error_map = [ '#ifdef VALIDATION_ERROR_MAP_IMPL', vuid_string_to_error_map_decl + ' {'] enum_value = 0 max_enum_val = 0 for enum in sorted(self.error_db_dict): @@ -214,8 +216,16 @@ class Specification: max_enum_val = max(max_enum_val, enum_value) enum_decl.append(' %sMAX_ENUM = %d,' % (validation_error_enum_name, max_enum_val + 1)) enum_decl.append('};') - vuid_int_to_error_map.append('};\n') - vuid_string_to_error_map.append('};\n') + vuid_int_to_error_map.extend([ + '};', + '#else', + 'extern ' + vuid_int_to_error_map_decl + ';', + '#endif\n']) + vuid_string_to_error_map.extend([ + '};', + '#else', + 'extern ' + vuid_string_to_error_map_decl + ';', + '#endif\n']) file_contents.extend(enum_decl) file_contents.append('\n// Mapping from unique validation error enum to the corresponding spec text') file_contents.extend(vuid_int_to_error_map) |