diff options
author | Tobin Ehlis <tobine@google.com> | 2016-07-14 14:37:51 -0600 |
---|---|---|
committer | Tobin Ehlis <tobine@google.com> | 2016-07-14 14:37:51 -0600 |
commit | ccfb520ed88fda80fe72d0b21938856ad3202e03 (patch) | |
tree | a2f5d55cc4c56ba5d6fab26ed340dd58c9370e74 /vk-layer-generate.py | |
parent | f47de6a165efddc86290017568cfb1a4ed7cccff (diff) |
layers: On Free/Destroy fix unique_objects map cleanup
When an object is freed or destroyed, unique_objects must clean up its
map entry prior to calling down the chain. This is becase the ICD may
be preempted just after object deletion, and the same object handle
could then be allocated before returning to validation. In that case,
unique_objects would delete the entry for the newly-created object.
Diffstat (limited to 'vk-layer-generate.py')
-rwxr-xr-x | vk-layer-generate.py | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/vk-layer-generate.py b/vk-layer-generate.py index 3ead8c01..1125e4cb 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -1608,6 +1608,7 @@ class UniqueObjectsSubcommand(Subcommand): for del_obj in sorted(struct_uses): pre_call_txt += '%suint64_t local_%s = reinterpret_cast<uint64_t &>(%s);\n' % (indent, del_obj, del_obj) pre_call_txt += '%s%s = (%s)my_map_data->unique_id_mapping[local_%s];\n' % (indent, del_obj, struct_uses[del_obj], del_obj) + pre_call_txt += '%smy_map_data->unique_id_mapping.erase(local_%s);\n' % (indent, proto.params[-2].name) pre_call_txt += '%slock.unlock();\n' % (indent) (pre_decl, pre_code, post_code) = ('', '', '') else: @@ -1660,20 +1661,6 @@ class UniqueObjectsSubcommand(Subcommand): post_call_txt += '%s*%s = reinterpret_cast<%s&>(unique_id);\n' % (indent, obj_name, obj_type) indent = indent[4:] post_call_txt += '%s}\n' % (indent) - elif destroy_func: - del_obj = proto.params[-2].name - if 'count' in del_obj.lower(): - post_call_txt += '%s\n' % (self.lineinfo.get()) - post_call_txt += '%sfor (uint32_t i=0; i<%s; ++i) {\n' % (indent, del_obj) - del_obj = proto.params[-1].name - indent += ' ' - post_call_txt += '%sdelete (VkUniqueObject*)%s[i];\n' % (indent, del_obj) - indent = indent[4:] - post_call_txt += '%s}\n' % (indent) - else: - post_call_txt += '%s\n' % (self.lineinfo.get()) - post_call_txt += '%slock.lock();\n' % (indent) - post_call_txt += '%smy_map_data->unique_id_mapping.erase(local_%s);\n' % (indent, proto.params[-2].name) call_sig = proto.c_call() # Replace default params with any custom local params |