Skip to content

Commit 47c5aba

Browse files
info: Add support for VK_KHR_display
This prints the results of vkGetPhysicalDeviceDisplayPropertiesKHR(), vkGetPhysicalDeviceDisplayPlanePropertiesKHR() and other related property lookups. It does not provide support to create a VK_KHR_display surface and query it. It also does not try to use VK_EXT_direct_mode_display to take control of the display from the window system.
1 parent e8a4ce7 commit 47c5aba

File tree

6 files changed

+842
-26
lines changed

6 files changed

+842
-26
lines changed

scripts/generators/vulkaninfo_generator.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python3
22
#
3-
# Copyright (c) 2019-2022 Valve Corporation
4-
# Copyright (c) 2019-2022 LunarG, Inc.
3+
# Copyright (c) 2019-2026 Valve Corporation
4+
# Copyright (c) 2019-2026 LunarG, Inc.
55
# Copyright (c) 2019-2022 Google Inc.
66
# Copyright (c) 2023-2024 RasterGrid Kft.
77
#
@@ -25,9 +25,9 @@
2525

2626
LICENSE_HEADER = '''
2727
/*
28-
* Copyright (c) 2019-2022 The Khronos Group Inc.
29-
* Copyright (c) 2019-2022 Valve Corporation
30-
* Copyright (c) 2019-2022 LunarG, Inc.
28+
* Copyright (c) 2019-2026 The Khronos Group Inc.
29+
* Copyright (c) 2019-2026 Valve Corporation
30+
* Copyright (c) 2019-2026 LunarG, Inc.
3131
* Copyright (c) 2023-2024 RasterGrid Kft.
3232
*
3333
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,14 +77,17 @@
7777
'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties',
7878
'VkSurfacePresentScalingCapabilitiesKHR', 'VkSurfacePresentModeCompatibilityKHR', 'VkPhysicalDeviceHostImageCopyProperties',
7979
'VkVideoProfileInfoKHR', 'VkVideoCapabilitiesKHR', 'VkVideoFormatPropertiesKHR', 'VkCooperativeMatrixPropertiesKHR',
80-
'VkPhysicalDeviceFragmentShadingRateKHR', 'VkMultisamplePropertiesEXT']
80+
'VkPhysicalDeviceFragmentShadingRateKHR', 'VkMultisamplePropertiesEXT',
81+
'VkDisplayPropertiesKHR', 'VkDisplayPlanePropertiesKHR', 'VkDisplayPlaneCapabilitiesKHR', 'VkDisplayModePropertiesKHR',
82+
'VkDisplayModeParametersKHR']
83+
8184
ENUMS_TO_GEN = ['VkResult', 'VkFormat', 'VkPresentModeKHR',
8285
'VkPhysicalDeviceType', 'VkImageTiling', 'VkTimeDomainKHR']
8386
FLAGS_TO_GEN = ['VkSurfaceTransformFlagsKHR', 'VkCompositeAlphaFlagsKHR', 'VkSurfaceCounterFlagsEXT', 'VkQueueFlags',
8487
'VkDeviceGroupPresentModeFlagsKHR', 'VkFormatFeatureFlags', 'VkFormatFeatureFlags2', 'VkMemoryPropertyFlags', 'VkMemoryHeapFlags']
8588
FLAG_STRINGS_TO_GEN = ['VkQueueFlags']
8689

87-
STRUCT_SHORT_VERSIONS_TO_GEN = ['VkExtent3D']
90+
STRUCT_SHORT_VERSIONS_TO_GEN = ['VkExtent3D', 'VkExtent2D']
8891

8992
STRUCT_COMPARISONS_TO_GEN = ['VkSurfaceFormatKHR', 'VkSurfaceFormat2KHR', 'VkSurfaceCapabilitiesKHR',
9093
'VkSurfaceCapabilities2KHR', 'VkSurfaceCapabilities2EXT']
@@ -100,7 +103,7 @@
100103
PREDEFINED_TYPES = ['char', 'VkBool32', 'uint32_t', 'uint8_t', 'int32_t',
101104
'float', 'uint64_t', 'size_t', 'VkDeviceSize', 'int64_t']
102105

103-
NAMES_TO_IGNORE = ['sType', 'pNext']
106+
NAMES_TO_IGNORE = ['sType', 'pNext', 'displayMode', 'display', 'currentDisplay']
104107

105108
EXTENSION_TYPE_INSTANCE = 'instance'
106109
EXTENSION_TYPE_DEVICE = 'device'
@@ -229,9 +232,11 @@ def generate(self):
229232

230233
if bitmask.flagName in FLAG_STRINGS_TO_GEN:
231234
out.extend(self.PrintBitMaskToString(bitmask, bitmask.flagName))
232-
235+
# make sure dump functions for nested structures are declared before use
236+
for s in (x for x in types_to_gen if x in self.vk.structs and x not in STRUCT_BLACKLIST):
237+
out.extend(self.PrintStructure(self.vk.structs[s], True))
233238
for s in (x for x in types_to_gen if x in self.vk.structs and x not in STRUCT_BLACKLIST):
234-
out.extend(self.PrintStructure(self.vk.structs[s]))
239+
out.extend(self.PrintStructure(self.vk.structs[s], False))
235240

236241
for key, value in EXTENSION_CATEGORIES.items():
237242
out.extend(self.PrintChainStruct(key, extension_types[key], value))
@@ -782,7 +787,7 @@ def PrintBitMaskToString(self, bitmask, name):
782787
return out
783788

784789

785-
def PrintStructure(self,struct):
790+
def PrintStructure(self,struct, declare_only):
786791
if len(struct.members) == 0:
787792
return []
788793
out = []
@@ -791,8 +796,12 @@ def PrintStructure(self,struct):
791796
for v in struct.members:
792797
if (v.type in PREDEFINED_TYPES or v.type in STRUCT_BLACKLIST) and (v.length is None or v.type in ['char'] or v.fixedSizeArray[0] in ['VK_UUID_SIZE', 'VK_LUID_SIZE']):
793798
max_key_len = max(max_key_len, len(v.name))
794-
795-
out.append(f'void Dump{struct.name}(Printer &p, std::string name, const {struct.name} &obj) {{\n')
799+
out.append(f'void Dump{struct.name}(Printer &p, std::string name, const {struct.name} &obj)')
800+
if declare_only:
801+
out.append(';\n')
802+
out.append(self.AddGuardFooter(struct))
803+
return out
804+
out.append(' {\n')
796805
if struct.name == 'VkPhysicalDeviceLimits':
797806
out.append(' if (p.Type() == OutputType::json)\n')
798807
out.append(' p.ObjectStart("limits");\n')

vulkaninfo/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|GNU")
9393
target_compile_definitions(vulkaninfo PRIVATE VK_USE_PLATFORM_DIRECTFB_EXT)
9494
target_link_libraries(vulkaninfo PRIVATE PkgConfig::DirectFB)
9595
endif()
96+
target_compile_definitions(vulkaninfo PRIVATE VK_USE_PLATFORM_DISPLAY)
9697
endif()
9798

9899
if(APPLE)

0 commit comments

Comments
 (0)