aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-01-08 14:52:49 -0700
committerMark Lobodzinski <mark@lunarg.com>2016-01-08 14:52:49 -0700
commit939e484bf0116f2430177a12725beddc01a74bb9 (patch)
tree9615da3c76afa485f3ebc9be09cde11d2d8ca6e6
parent8680101e489263e4730f1e2b95098ed7d7e137eb (diff)
downloadusermoji-939e484bf0116f2430177a12725beddc01a74bb9.tar.xz
layers: Gitlab 41 & 61, Fix invalid descriptor dereferences in helper codegen
Descriptor type arrays should only be dereferenced depending on the specified descriptorType parameter. Caused crashes in api_dump.
-rwxr-xr-xvk_helper.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/vk_helper.py b/vk_helper.py
index 6dfced67..fd5c96e0 100755
--- a/vk_helper.py
+++ b/vk_helper.py
@@ -884,6 +884,22 @@ class StructWrapperGen:
else:
sh_funcs.append('%sif (pStruct->sharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent))
indent += ' '
+ if (stp_list[index]['name'] == 'pImageInfo'):
+ sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)) {' % (indent))
+ indent += ' '
+ elif (stp_list[index]['name'] == 'pBufferInfo'):
+ sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) {' % (indent))
+ indent += ' '
+ elif (stp_list[index]['name'] == 'pTexelBufferView'):
+ sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) ||' % (indent))
+ sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) {' % (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))
@@ -921,7 +937,7 @@ class StructWrapperGen:
indent = indent[4:]
sh_funcs.append('%s}' % (indent))
#endif
- if (stp_list[index]['name'] == 'pQueueFamilyIndices'):
+ if (stp_list[index]['name'] == 'pQueueFamilyIndices') or (stp_list[index]['name'] == 'pImageInfo') or (stp_list[index]['name'] == 'pBufferInfo') or (stp_list[index]['name'] == 'pTexelBufferView'):
indent = indent[4:]
sh_funcs.append('%s}' % (indent))
elif (stp_list[index]['ptr']):