layers: Split OT inst/dev layer data maps
Including making instance/device versions of object tracking and
validation routines. This is necessary to be consistent with other
layer models.
Change-Id: I13a5942cbef06ca392b32e140bde727d52992946
diff --git a/scripts/object_tracker_generator.py b/scripts/object_tracker_generator.py
index f08c42c..ed923a7 100644
--- a/scripts/object_tracker_generator.py
+++ b/scripts/object_tracker_generator.py
@@ -702,7 +702,13 @@
create_obj_code += '%sfor (uint32_t index = 0; index < %s; index++) {\n' % (indent, cmd_info[-1].len)
indent = self.incIndent(indent)
object_dest = '%s[index]' % cmd_info[-1].name
- create_obj_code += '%sCreateObject(%s, %s, %s, %s);\n' % (indent, params[0].find('name').text, object_dest, self.GetVulkanObjType(cmd_info[-1].type), allocator)
+
+ dispobj = params[0].find('type').text
+ calltype = 'Device'
+ if dispobj == 'VkInstance' or dispobj == 'VkPhysicalDevice':
+ calltype = 'Instance'
+
+ create_obj_code += '%s%sCreateObject(%s, %s, %s, %s);\n' % (indent, calltype, params[0].find('name').text, object_dest, self.GetVulkanObjType(cmd_info[-1].type), allocator)
if object_array == True:
indent = self.decIndent(indent)
create_obj_code += '%s}\n' % indent
@@ -730,9 +736,13 @@
# This API is freeing an array of handles -- add loop control
validate_code += 'HEY, NEED TO DESTROY AN ARRAY\n'
else:
+ dispobj = cmd_info[0].type
+ calltype = 'Device'
+ if dispobj == 'VkInstance' or dispobj == 'VkPhysicalDevice':
+ calltype = 'Instance'
# Call Destroy a single time
- validate_code += '%s skip |= ValidateDestroyObject(%s, %s, %s, pAllocator, %s, %s);\n' % (indent, cmd_info[0].name, cmd_info[param].name, self.GetVulkanObjType(cmd_info[param].type), compatalloc_vuid, nullalloc_vuid)
- record_code += '%s RecordDestroyObject(%s, %s, %s);\n' % (indent, cmd_info[0].name, cmd_info[param].name, self.GetVulkanObjType(cmd_info[param].type))
+ validate_code += '%s skip |= %sValidateDestroyObject(%s, %s, %s, pAllocator, %s, %s);\n' % (indent, calltype, cmd_info[0].name, cmd_info[param].name, self.GetVulkanObjType(cmd_info[param].type), compatalloc_vuid, nullalloc_vuid)
+ record_code += '%s %sRecordDestroyObject(%s, %s, %s);\n' % (indent, calltype, cmd_info[0].name, cmd_info[param].name, self.GetVulkanObjType(cmd_info[param].type))
return object_array, validate_code, record_code
#
# Output validation for a single object (obj_count is NULL) or a counted list of objects
@@ -746,14 +756,17 @@
# If no parent VUID for this member, look for a commonparent VUID
if parent_vuid == 'kVUIDUndefined':
parent_vuid = self.GetVuid(parent_name, 'commonparent')
+ calltype = 'Device'
+ if disp_name == 'instance' or disp_name == 'physicalDevice':
+ calltype = 'Instance'
if obj_count is not None:
pre_call_code += '%s for (uint32_t %s = 0; %s < %s; ++%s) {\n' % (indent, index, index, obj_count, index)
indent = self.incIndent(indent)
- pre_call_code += '%s skip |= ValidateObject(%s, %s%s[%s], %s, %s, %s, %s);\n' % (indent, disp_name, prefix, obj_name, index, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid)
+ pre_call_code += '%s skip |= %sValidateObject(%s, %s%s[%s], %s, %s, %s, %s);\n' % (indent, calltype, disp_name, prefix, obj_name, index, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid)
indent = self.decIndent(indent)
pre_call_code += '%s }\n' % indent
else:
- pre_call_code += '%s skip |= ValidateObject(%s, %s%s, %s, %s, %s, %s);\n' % (indent, disp_name, prefix, obj_name, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid)
+ pre_call_code += '%s skip |= %sValidateObject(%s, %s%s, %s, %s, %s, %s);\n' % (indent, calltype, disp_name, prefix, obj_name, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid)
return pre_call_code
#
# first_level_param indicates if elements are passed directly into the function else they're below a ptr/struct
@@ -1013,11 +1026,13 @@
# Use correct dispatch table
disp_name = cmdinfo.elem.find('param/name').text
disp_type = cmdinfo.elem.find('param/type').text
+ map_type = ''
if disp_type in ["VkInstance", "VkPhysicalDevice"] or cmdname == 'vkCreateInstance':
object_type = 'instance'
+ map_type = 'instance_'
else:
object_type = 'device'
- dispatch_table = 'GetLayerDataPtr(get_dispatch_key(%s), layer_data_map)->%s_dispatch_table.' % (disp_name, object_type)
+ dispatch_table = 'GetLayerDataPtr(get_dispatch_key(%s), %slayer_data_map)->%s_dispatch_table.' % (disp_name, map_type, object_type)
down_chain_call = fcn_call.replace('TOKEN', dispatch_table, 1)
self.appendSection('command', ' ' + assignresult + down_chain_call)