aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vulkaninfo_generator.py82
1 files changed, 34 insertions, 48 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py
index b5c5f662..46125f98 100644
--- a/scripts/vulkaninfo_generator.py
+++ b/scripts/vulkaninfo_generator.py
@@ -114,35 +114,39 @@ EXTENSION_CATEGORIES = OrderedDict((
{'extends': 'VkPhysicalDeviceProperties2',
'type': EXTENSION_TYPE_BOTH,
'holder_type': 'VkPhysicalDeviceProperties2',
- 'print_iterator': True}),
+ 'print_iterator': True,
+ 'can_show_promoted_structs': True}),
('phys_device_mem_props2',
{'extends': 'VkPhysicalDeviceMemoryProperties2',
- 'type': EXTENSION_TYPE_DEVICE,
- 'holder_type':'VkPhysicalDeviceMemoryProperties2',
- 'print_iterator': False}),
+ 'type': EXTENSION_TYPE_DEVICE,
+ 'holder_type':'VkPhysicalDeviceMemoryProperties2',
+ 'print_iterator': False,
+ 'can_show_promoted_structs': False}),
('phys_device_features2',
{'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo',
- 'type': EXTENSION_TYPE_DEVICE,
- 'holder_type': 'VkPhysicalDeviceFeatures2',
- 'print_iterator': True}),
+ 'type': EXTENSION_TYPE_DEVICE,
+ 'holder_type': 'VkPhysicalDeviceFeatures2',
+ 'print_iterator': True,
+ 'can_show_promoted_structs': True}),
('surface_capabilities2',
{'extends': 'VkSurfaceCapabilities2KHR',
- 'type': EXTENSION_TYPE_BOTH,
- 'holder_type': 'VkSurfaceCapabilities2KHR',
- 'print_iterator': True,
- 'exclude': [# VK_EXT_surface_maintenance1 is difficult to code-gen
- 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT'
- ]}),
+ 'type': EXTENSION_TYPE_BOTH,
+ 'holder_type': 'VkSurfaceCapabilities2KHR',
+ 'print_iterator': True,
+ 'can_show_promoted_structs': False,
+ 'exclude': ['VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT']}),
('format_properties2',
{'extends': 'VkFormatProperties2',
- 'type': EXTENSION_TYPE_DEVICE,
- 'holder_type':'VkFormatProperties2',
- 'print_iterator': True}),
+ 'type': EXTENSION_TYPE_DEVICE,
+ 'holder_type':'VkFormatProperties2',
+ 'print_iterator': True,
+ 'can_show_promoted_structs': False}),
('queue_properties2',
{'extends': 'VkQueueFamilyProperties2',
- 'type': EXTENSION_TYPE_DEVICE,
- 'holder_type': 'VkQueueFamilyProperties2',
- 'print_iterator': True})
+ 'type': EXTENSION_TYPE_DEVICE,
+ 'holder_type': 'VkQueueFamilyProperties2',
+ 'print_iterator': True,
+ 'can_show_promoted_structs': False})
))
class VulkanInfoGeneratorOptions(GeneratorOptions):
def __init__(self,
@@ -752,6 +756,8 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
out += 'AppInstance &inst, '
if chain_details.get('type') in [EXTENSION_TYPE_DEVICE, EXTENSION_TYPE_BOTH]:
out += 'AppGpu &gpu '
+ if chain_details.get('can_show_promoted_structs'):
+ out += ', bool show_promoted_structs'
out += ') noexcept {\n'
for s in structs_to_print:
if s.name in STRUCT_BLACKLIST:
@@ -801,12 +807,13 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
else:
assert False, 'Should never get here'
if has_version:
+ str_show_promoted_structs = '|| show_promoted_structs' if chain_details.get('can_show_promoted_structs') else ''
if s.name in STRUCT_1_1_LIST:
- out += f'{version_desc} == {version.constant}'
+ out += f'{version_desc} == {version.constant} {str_show_promoted_structs}'
elif has_printed_condition:
- out += f')\n && {version_desc} < {version.constant}'
+ out += f')\n && ({version_desc} < {version.constant} {str_show_promoted_structs})'
else:
- out += f'{version_desc} >= {version.constant}'
+ out += f'({version_desc} >= {version.constant})'
out += ')\n '
else:
out += ' '
@@ -820,6 +827,9 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
if chain_details.get('type') in [EXTENSION_TYPE_DEVICE, EXTENSION_TYPE_BOTH]:
chain_param_list.append('AppGpu &gpu')
chain_arg_list.append('gpu')
+ if chain_details.get('can_show_promoted_structs'):
+ chain_param_list.append('bool show_promoted_structs')
+ chain_arg_list.append('show_promoted_structs')
out += f'''
if (!chain_members.empty()) {{
@@ -843,6 +853,8 @@ void setup_{listName}_chain({chain_details['holder_type']}& start, std::unique_p
out += 'AppInstance &inst, '
if chain_details.get('type') in [EXTENSION_TYPE_DEVICE, EXTENSION_TYPE_BOTH]:
out += 'AppGpu &gpu, '
+ if chain_details.get('can_show_promoted_structs'):
+ out += 'bool show_promoted_structs, '
out += 'void * place) {\n'
out += ' while (place) {\n'
out += ' struct VkBaseOutStructure *structure = (struct VkBaseOutStructure *)place;\n'
@@ -874,32 +886,6 @@ void setup_{listName}_chain({chain_details['holder_type']}& start, std::unique_p
out += ' && p.Type() != OutputType::json'
has_version = version is not None
has_extNameStr = len(extEnables) > 0 or s.name in aliases.keys()
-
- if has_version or has_extNameStr:
- out += ' &&\n ('
- has_printed_condition = False
- if has_extNameStr:
- for key, value in extEnables.items():
- if has_printed_condition:
- out += ' || '
- else:
- has_printed_condition = True
- if has_version:
- out += '('
- if value == EXTENSION_TYPE_DEVICE:
- out += f'gpu.CheckPhysicalDeviceExtensionIncluded({key})'
- elif value == EXTENSION_TYPE_INSTANCE:
- out += f'inst.CheckExtensionEnabled({key})'
- else:
- assert False, 'Should never get here'
- if has_version:
- if s.name in STRUCT_1_1_LIST:
- out += f'{version_desc} == {version.constant}'
- elif has_printed_condition:
- out += f') &&\n {version_desc} < {version.constant}'
- else:
- out += f'{version_desc} >= {version.constant}'
- out += ')'
out += ') {\n'
out += f' {s.name}* props = ({s.name}*)structure;\n'
out += f' Dump{s.name}(p, '