From def1170071d3e66ce4501c2f0db5dbfd39fcb9c5 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 11 Aug 2015 09:35:02 -0600 Subject: layers: Handle uninitialized QueueFamily values in APIDump If queueFamilyCount or pQueueFamilyIndices were uninitialized, APIDump would persist in printing this info resulting in a segfault. Added check for sharingMode before examining these values. --- vk_helper.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vk_helper.py b/vk_helper.py index 906c9162..cc28cd02 100755 --- a/vk_helper.py +++ b/vk_helper.py @@ -835,6 +835,9 @@ class StructWrapperGen: if not idx_ss_decl: sh_funcs.append('%sstringstream index_ss;' % (indent)) idx_ss_decl = True + if (stp_list[index]['name'] == 'pQueueFamilyIndices'): + sh_funcs.append('%sif (pStruct->sharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent)) + indent += ' ' sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name'])) indent += ' ' sh_funcs.append('%sfor (uint32_t i = 0; i < %s; i++) {' % (indent, array_count)) @@ -872,6 +875,10 @@ class StructWrapperGen: sh_funcs.append('%s}' % (indent)) indent = indent[4:] sh_funcs.append('%s}' % (indent)) + #endif + if (stp_list[index]['name'] == 'pQueueFamilyIndices'): + indent = indent[4:] + sh_funcs.append('%s}' % (indent)) elif (stp_list[index]['ptr']): sh_funcs.append('%s' % lineinfo.get()) sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name'])) -- cgit v1.2.3