aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2023-10-05 11:29:43 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2023-10-05 14:05:20 -0600
commit8197ec6dae2d27744f0795769277a4e44717d33b (patch)
treead0bc3319ed776ab8fc72c3b6865ed0284fa6325 /scripts
parent0067d4cb64dad8e8c753efcf1dd120347e682300 (diff)
downloadusermoji-8197ec6dae2d27744f0795769277a4e44717d33b.tar.xz
vulkaninfo: Fix printing arrays of Enums
Previously, the code generator assumed enums were always printed as key-value pairs, and not in an array. This led to using object syntax inside of arrays in the JSON output, which is invalid, and is now fixed.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vulkaninfo_generator.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py
index 9d7d683a..3aa2a4ec 100644
--- a/scripts/vulkaninfo_generator.py
+++ b/scripts/vulkaninfo_generator.py
@@ -601,10 +601,13 @@ def PrintStructure(struct, types_to_gen, structure_names, aliases):
out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n'
out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n"
if v.typeID in types_to_gen:
- out += f" if (obj.{v.name} != nullptr) {{\n"
- out += f" p.SetElementIndex(i);\n"
- out += f' Dump{v.typeID}(p, "{v.name}", obj.{v.name}[i]);\n'
- out += f" }}\n"
+ out += f' if (obj.{v.name} != nullptr) {{\n'
+ out += f' p.SetElementIndex(i);\n'
+ out += ' if (p.Type() == OutputType::json)\n'
+ out += f' p.PrintString(std::string("VK_") + {v.typeID}String(obj.{v.name}[i]));\n'
+ out += ' else\n'
+ out += f' p.PrintString({v.typeID}String(obj.{v.name}[i]));\n'
+ out += f' }}\n'
else:
out += f" p.PrintElement(obj.{v.name}[i]);\n"
out += f" }}\n"