-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
54 lines (44 loc) · 1.97 KB
/
Copy pathexample.py
File metadata and controls
54 lines (44 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
# Copyright 2025 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Click on 'VulkanObject' with your IDE/TextEditor to see VulkanObject definition
# https://github.com/KhronosGroup/Vulkan-Headers/blob/main/registry/vulkan_object.py
#
# This needs to be ran after installing the package
#
# If you cloned the repo, need to update this to 'src.vulkan_object' or you will get
# ModuleNotFoundError: No module named 'vulkan_object'
from vulkan_object import get_vulkan_object, VulkanObject
vk = get_vulkan_object()
# Example 1
global_functions = []
for command in vk.commands.values():
if command.params[0].type not in vk.handles:
global_functions.append(command.name)
print(f'Global functions are {global_functions}')
print("\n----------------------------------------------------\n")
# Example 2
print("VK_KHR_dynamic_rendering_local_read added the following commands")
extension = vk.extensions['VK_KHR_dynamic_rendering_local_read']
for command in [x for x in extension.commands]:
print(f'- {command.name}')
print("\n----------------------------------------------------\n")
# Example 3
struct = vk.structs['VkImageSubresource2']
print(f'VkImageSubresource2 also is known as {struct.aliases}')
print(f'Members are {[x.name for x in struct.members]}')
# use base type to get the next struct's info
struct = vk.structs[struct.members[2].type]
print(f'VkImageSubresource also is known as {struct.aliases}')
print(f'Members are {[x.name for x in struct.members]}')
print("\n----------------------------------------------------\n")
# Example 4
formats = [x for x in vk.formats.values() if x.compressed]
print(f'There are {len(formats)} compressed formats')
formats = [x for x in formats if x.blockSize == 8]
print(f'{len(formats)} have a block size of 8')
formats = [x for x in formats if x.blockExtent == ['4', '4', '1']]
print(f'{len(formats)} have a block extent of 4x4x1')
formats = "\n\t".join([x.name for x in formats])
print(f'They are:\n\t{formats}')