diff options
| author | Mike Schuchardt <mikes@lunarg.com> | 2017-09-04 11:38:42 -0600 |
|---|---|---|
| committer | Mike Schuchardt <mikes@lunarg.com> | 2017-09-07 14:19:31 -0700 |
| commit | 2339beae2e86a99030eda31818744ea23917ed1f (patch) | |
| tree | 8924356b577533f4b2a19b8e6a12b3e296fab7d4 /scripts | |
| parent | bbf52bb60f7f45e005d50d20668aee1e1e3b7805 (diff) | |
| download | usermoji-2339beae2e86a99030eda31818744ea23917ed1f.tar.xz | |
scripts: Fix VkShaderModuleCreateInfo safe struct
Allocate and copy the entire shader program instead of just the first 4
bytes.
Change-Id: I24dd136d59952f9e8b690bf4fe1702106482a3be
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/helper_file_generator.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py index f486a8d7..a9d9390f 100644 --- a/scripts/helper_file_generator.py +++ b/scripts/helper_file_generator.py @@ -787,7 +787,15 @@ class HelperFileOutputGenerator(OutputGenerator): ' break;\n' ' default:\n' ' break;\n' + ' }\n', + 'VkShaderModuleCreateInfo' : + ' if (in_struct->pCode) {\n' + ' pCode = reinterpret_cast<uint32_t *>(new uint8_t[codeSize]);\n' + ' memcpy((void *)pCode, (void *)in_struct->pCode, codeSize);\n' ' }\n'} + custom_destruct_txt = {'VkShaderModuleCreateInfo' : + ' if (pCode)\n' + ' delete[] reinterpret_cast<const uint8_t *>(pCode);\n' } for member in item.members: m_type = member.type @@ -864,6 +872,8 @@ class HelperFileOutputGenerator(OutputGenerator): init_list = init_list[:-1] # hack off final comma if item.name in custom_construct_txt: construct_txt = custom_construct_txt[item.name] + if item.name in custom_destruct_txt: + destruct_txt = custom_destruct_txt[item.name] safe_struct_body.append("\n%s::%s(const %s* in_struct) :%s\n{\n%s}" % (ss_name, ss_name, item.name, init_list, construct_txt)) if '' != default_init_list: default_init_list = " :%s" % (default_init_list[:-1]) |
