Layers: Add KHR/KHX/NN extensions to threading layer
These were skipped due to problems in codegen. Added support for new
objects into the layer, fixed codegen.
Change-Id: Iaf4fcaa229664f7d3118da4db35649fbdf36e2eb
diff --git a/scripts/threading_generator.py b/scripts/threading_generator.py
index 3ce26d2..3385784 100644
--- a/scripts/threading_generator.py
+++ b/scripts/threading_generator.py
@@ -134,19 +134,13 @@
def paramIsPointer(self, param):
ispointer = False
for elem in param:
- #write('paramIsPointer '+elem.text, file=sys.stderr)
- #write('elem.tag '+elem.tag, file=sys.stderr)
- #if (elem.tail is None):
- # write('elem.tail is None', file=sys.stderr)
- #else:
- # write('elem.tail '+elem.tail, file=sys.stderr)
if ((elem.tag is not 'type') and (elem.tail is not None)) and '*' in elem.tail:
ispointer = True
- # write('is pointer', file=sys.stderr)
return ispointer
def makeThreadUseBlock(self, cmd, functionprefix):
"""Generate C function pointer typedef for <command> Element"""
paramdecl = ''
+ # TODO: We should generate these lists
thread_check_dispatchable_objects = [
"VkCommandBuffer",
"VkDevice",
@@ -173,6 +167,12 @@
"VkSampler",
"VkSemaphore",
"VkShaderModule",
+ "VkObjectTableNVX",
+ "VkIndirectCommandsLayoutNVX",
+ "VkDisplayKHR",
+ "VkDisplayModeKHR",
+ "VkSurfaceKHR",
+ "VkSwapchainKHR",
]
# Find and add any parameters that are thread unsafe
@@ -214,6 +214,7 @@
# externsync can list members to synchronize
for member in externsync.split(","):
member = str(member).replace("::", "->")
+ member = str(member).replace(".", "->")
paramdecl += ' ' + functionprefix + 'WriteObject(my_data, ' + member + ');\n'
else:
paramtype = param.find('type')
@@ -223,7 +224,13 @@
paramtype = 'None'
if paramtype in thread_check_dispatchable_objects or paramtype in thread_check_nondispatchable_objects:
if self.paramIsArray(param) and ('pPipelines' != paramname.text):
- paramdecl += ' for (uint32_t index=0;index<' + param.attrib.get('len') + ';index++) {\n'
+ # Add pointer dereference for array counts that are pointer values
+ dereference = ''
+ for candidate in params:
+ if param.attrib.get('len') == candidate.find('name').text:
+ if self.paramIsPointer(candidate):
+ dereference = '*'
+ paramdecl += ' for (uint32_t index = 0; index < ' + dereference + param.attrib.get('len') + '; index++) {\n'
paramdecl += ' ' + functionprefix + 'ReadObject(my_data, ' + paramname.text + '[index]);\n'
paramdecl += ' }\n'
elif not self.paramIsPointer(param):
@@ -400,13 +407,7 @@
self.appendSection('command', decls[0])
self.intercepts += [ ' {"%s", reinterpret_cast<PFN_vkVoidFunction>(%s)},' % (name,name[2:]) ]
return
- if ("KHR" in name) or ("KHX" in name):
- self.appendSection('command', '// TODO - not wrapping KHR function ' + name)
- return
- if ("NN" in name):
- self.appendSection('command', '// TODO - not wrapping NN function ' + name)
- return
- if ("DebugMarker" in name) and ("EXT" in name):
+ if "QueuePresentKHR" in name or ("DebugMarker" in name and "EXT" in name):
self.appendSection('command', '// TODO - not wrapping EXT function ' + name)
return
# Determine first if this function needs to be intercepted