diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-02-12 14:37:09 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-02-18 14:47:06 -0700 |
| commit | 4d52f4d4c8aa4ed9b2bf398bce1d9702fc677cb9 (patch) | |
| tree | 59d899275378b504d91f24c741d81e3d8294ff9d /vk-layer-generate.py | |
| parent | e9821fbe3ecbd6b3a9cda927f3ec1f73828378e4 (diff) | |
| download | usermoji-4d52f4d4c8aa4ed9b2bf398bce1d9702fc677cb9.tar.xz | |
layers: Special case VkWriteDescriptorSet safe_struct code
VkWriteDescriptorSet may have non-null ptrs that we don't care about.
Add a special case for this struct in safe_struct codegen that will only
check the array ptrs that we care about based on the descriptorType.
Also update safe_struct codegen so that all ptrs in structs are initially
set as NULL, and then only updated if src struct ptr is non-NULL.
Update unique_objects to base "if" guards around ptrs to be based off of
the shadowed safe_struct ptrs for any ptrs below the first level input
params. This is because safe_struct initialization will have already copied
down any ptrs so if there are any additional guards in safe_struct
shadowing, such as for VkWriteDescriptorSet, this allows unique_objects.cpp
to make use of only valid info and not have to replicate special cases.
Diffstat (limited to 'vk-layer-generate.py')
| -rwxr-xr-x | vk-layer-generate.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vk-layer-generate.py b/vk-layer-generate.py index c5a81cdd..510f200b 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -1450,7 +1450,10 @@ class UniqueObjectsSubcommand(Subcommand): local_prefix = '' name = '%s%s' % (prefix, name) if ptr_type: - pre_code += '%sif (%s) {\n' % (indent, name) + if first_level_param and name in param_type: + pre_code += '%sif (%s) {\n' % (indent, name) + else: # shadow ptr will have been initialized at this point so check it vs. source ptr + pre_code += '%sif (local_%s) {\n' % (indent, name) indent += ' ' if array != '': idx = 'idx%s' % str(array_index) @@ -1487,7 +1490,10 @@ class UniqueObjectsSubcommand(Subcommand): if (array_index > 0) or array != '': # TODO : This is not ideal, really want to know if we're anywhere under an array if first_level_param: pre_code += '%s%s* local_%s = NULL;\n' % (indent, struct_uses[obj], name) - pre_code += '%sif (%s%s) {\n' %(indent, prefix, name) + if array != '' and not first_level_param: # ptrs under structs will have been initialized so use local_* + pre_code += '%sif (local_%s%s) {\n' %(indent, prefix, name) + else: + pre_code += '%sif (%s%s) {\n' %(indent, prefix, name) indent += ' ' if array != '': idx = 'idx%s' % str(array_index) |
