diff options
| author | Charles Giessen <charles@lunarg.com> | 2026-01-20 09:34:28 -0600 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2026-01-20 13:12:03 -0600 |
| commit | 983f86f9b5f5de9ce37349f42c38d6418218126f (patch) | |
| tree | 876a0b06784277f8d8adb51652361dd329eeb448 /scripts | |
| parent | ab8520f3445dbf823d3927d6faf22b7f5651000a (diff) | |
| download | usermoji-983f86f9b5f5de9ce37349f42c38d6418218126f.tar.xz | |
vulkaninfo: Fix string printing in VK_KHR_display
Strings must be printed with the PrintString/PrintKeyString functions in
order to properly escape and quote them in the JSON output.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/generators/vulkaninfo_generator.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/generators/vulkaninfo_generator.py b/scripts/generators/vulkaninfo_generator.py index 86a32c48..472459ac 100644 --- a/scripts/generators/vulkaninfo_generator.py +++ b/scripts/generators/vulkaninfo_generator.py @@ -817,13 +817,19 @@ std::vector<std::unique_ptr<AppVideoProfile>> enumerate_supported_video_profiles if max_key_len > 0: out.append(f' p.SetMinKeyWidth({max_key_len});\n') for v in struct.members: + # strings + if v.type == 'char': + if v.pointer == True: + out.append(f' if (obj.{v.name} == nullptr) {{') + out.append(f' p.PrintKeyString("{v.name}", "NULL");\n') + out.append(' } else {') + out.append(f' p.PrintKeyString("{v.name}", obj.{v.name});\n') + if v.pointer == True: + out.append(' }') # arrays - if v.length is not None: - # strings - if v.type == 'char': - out.append(f' p.PrintKeyString("{v.name}", obj.{v.name});\n') + elif v.length is not None: # uuid's - elif v.type == 'uint8_t' and (v.fixedSizeArray[0] == 'VK_LUID_SIZE' or v.fixedSizeArray[0] == 'VK_UUID_SIZE'): # VK_UUID_SIZE + if v.type == 'uint8_t' and (v.fixedSizeArray[0] == 'VK_LUID_SIZE' or v.fixedSizeArray[0] == 'VK_UUID_SIZE'): # VK_UUID_SIZE if v.fixedSizeArray[0] == 'VK_LUID_SIZE': out.append(' if (obj.deviceLUIDValid) { // special case\n') out.append(f' p.PrintKeyValue("{v.name}", obj.{v.name});\n') |
