Skip to content

Commit

Permalink
vulkaninfo: Fix including promoted structures
Browse files Browse the repository at this point in the history
  • Loading branch information
ziga-lunarg committed Dec 2, 2023
1 parent 8718f7f commit 5dd8e92
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 350 deletions.
18 changes: 12 additions & 6 deletions scripts/vulkaninfo_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
STRUCT_COMPARISONS_TO_GEN = ['VkSurfaceFormatKHR', 'VkSurfaceFormat2KHR', 'VkSurfaceCapabilitiesKHR',
'VkSurfaceCapabilities2KHR', 'VkSurfaceCapabilities2EXT']
# don't generate these structures
STRUCT_BLACKLIST = ['VkVideoProfileListInfoKHR', 'VkVideoProfileInfoKHR', 'VkDrmFormatModifierPropertiesListEXT', 'VkDrmFormatModifierPropertiesEXT', 'VkDrmFormatModifierPropertiesList2EXT']
STRUCT_BLACKLIST = ['VkVideoProfileListInfoKHR', 'VkVideoProfileInfoKHR', 'VkDrmFormatModifierPropertiesListEXT', 'VkDrmFormatModifierPropertiesEXT', 'VkDrmFormatModifierPropertiesList2EXT', 'VkPhysicalDeviceProtectedMemoryFeatures', 'VkPhysicalDeviceShaderDrawParametersFeatures', 'VkPhysicalDeviceSubgroupProperties', 'VkPhysicalDeviceProtectedMemoryProperties']

# generate these structures such that they only print when not in json mode (as json wants them separate)
PORTABILITY_STRUCTS = ['VkPhysicalDevicePortabilitySubsetFeaturesKHR', 'VkPhysicalDevicePortabilitySubsetPropertiesKHR']
Expand Down Expand Up @@ -804,8 +804,9 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
assert False, 'Should never get here'
if has_version:
if has_printed_condition:
out += '\n || '
out += f'{version_desc}.minor >= {str(version)}'
out += f'\n && {version_desc}.minor < {str(version)}'
else:
out += f'{version_desc}.minor >= {str(version)}'
out += ')\n '
else:
out += ' '
Expand Down Expand Up @@ -881,17 +882,22 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
for key, value in extEnables.items():
if has_printed_condition:
out += ' || '
has_printed_condition = True
else:
has_printed_condition = True
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_printed_condition:
out += ')'
if has_version:
if has_printed_condition:
out += ' ||\n '
out += f'{version_desc}.minor >= {str(version)}'
out += f' &&\n {version_desc}.minor < {str(version)}'
else:
out += f'{version_desc}.minor >= {str(version)}'
out += ')'
out += ') {\n'
out += f' {s.name}* props = ({s.name}*)structure;\n'
Expand Down
Loading

0 comments on commit 5dd8e92

Please sign in to comment.