|
1501
|
1 #!/usr/bin/env python3 -i
|
|
|
2 #
|
|
|
3 # Copyright 2023-2025 The Khronos Group Inc.
|
|
|
4 #
|
|
|
5 # SPDX-License-Identifier: Apache-2.0
|
|
|
6
|
|
|
7 from dataclasses import dataclass, field
|
|
|
8 from enum import IntFlag, Enum, auto
|
|
|
9
|
|
|
10 @dataclass
|
|
|
11 class FeatureRequirement:
|
|
|
12 """Each instance of FeatureRequirement is one part of the AND operation,
|
|
|
13 unless the struct/field are the same, then the depends are AND togethered"""
|
|
|
14 struct: str
|
|
|
15 field: str # Can have comma delimiter, which are expressed as OR
|
|
|
16 depends: (str | None) # ex) "VK_EXT_descriptor_indexing", "VK_VERSION_1_2+VkPhysicalDeviceVulkan12Features::descriptorIndexing"
|
|
|
17
|
|
|
18 @dataclass
|
|
|
19 class Extension:
|
|
|
20 """<extension>"""
|
|
|
21 name: str # ex) VK_KHR_SURFACE
|
|
|
22 nameString: str # marco with string, ex) VK_KHR_SURFACE_EXTENSION_NAME
|
|
|
23 specVersion: str # marco with string, ex) VK_KHR_SURFACE_SPEC_VERSION
|
|
|
24
|
|
|
25 # Only one will be True, the other is False
|
|
|
26 instance: bool
|
|
|
27 device: bool
|
|
|
28
|
|
|
29 depends: (str | None)
|
|
|
30 vendorTag: (str | None) # ex) EXT, KHR, etc
|
|
|
31 platform: (str | None) # ex) android
|
|
|
32 protect: (str | None) # ex) VK_USE_PLATFORM_ANDROID_KHR
|
|
|
33 provisional: bool
|
|
|
34 promotedTo: (str | None) # ex) VK_VERSION_1_1
|
|
|
35 deprecatedBy: (str | None)
|
|
|
36 obsoletedBy: (str | None)
|
|
|
37 specialUse: list[str]
|
|
|
38 featureRequirement: list[FeatureRequirement]
|
|
|
39 ratified: bool
|
|
|
40
|
|
|
41 # These are here to allow for easy reverse lookups
|
|
|
42 # To prevent infinite recursion, other classes reference a string back to the Extension class
|
|
|
43 # Quotes allow us to forward declare the dataclass
|
|
|
44 handles: list['Handle'] = field(default_factory=list, init=False)
|
|
|
45 commands: list['Command'] = field(default_factory=list, init=False)
|
|
|
46 structs: list['Struct'] = field(default_factory=list, init=False)
|
|
|
47 enums: list['Enum'] = field(default_factory=list, init=False)
|
|
|
48 bitmasks: list['Bitmask'] = field(default_factory=list, init=False)
|
|
|
49 flags: dict[str, list['Flags']] = field(default_factory=dict, init=False)
|
|
|
50 # Use the Enum name to see what fields are extended
|
|
|
51 enumFields: dict[str, list['EnumField']] = field(default_factory=dict, init=False)
|
|
|
52 # Use the Bitmask name to see what flag bits are added to it
|
|
|
53 flagBits: dict[str, list['Flag']] = field(default_factory=dict, init=False)
|
|
|
54
|
|
|
55 @dataclass
|
|
|
56 class Version:
|
|
|
57 """
|
|
|
58 <feature> which represents a version
|
|
|
59 This will NEVER be Version 1.0, since having 'no version' is same as being 1.0
|
|
|
60 """
|
|
|
61 name: str # ex) VK_VERSION_1_1
|
|
|
62 nameString: str # ex) "VK_VERSION_1_1" (no marco, so has quotes)
|
|
|
63 nameApi: str # ex) VK_API_VERSION_1_1
|
|
|
64
|
|
|
65 featureRequirement: list[FeatureRequirement]
|
|
|
66
|
|
|
67 @dataclass
|
|
|
68 class Legacy:
|
|
|
69 """<deprecate>
|
|
|
70 For historical reasons, the XML tag is "deprecate" but we decided in the WG to not use that as the public facing name
|
|
|
71 """
|
|
|
72 link: (str | None) # Spec URL Anchor - ex) legacy-dynamicrendering
|
|
|
73 version: (Version | None)
|
|
|
74 extensions: list[str]
|
|
|
75
|
|
|
76 @dataclass
|
|
|
77 class Handle:
|
|
|
78 """<type> which represents a dispatch handle"""
|
|
|
79 name: str # ex) VkBuffer
|
|
|
80 aliases: list[str] # ex) ['VkSamplerYcbcrConversionKHR']
|
|
|
81
|
|
|
82 type: str # ex) VK_OBJECT_TYPE_BUFFER
|
|
|
83 protect: (str | None) # ex) VK_USE_PLATFORM_ANDROID_KHR
|
|
|
84
|
|
|
85 parent: 'Handle' # Chain of parent handles, can be None
|
|
|
86
|
|
|
87 # Only one will be True, the other is False
|
|
|
88 instance: bool
|
|
|
89 device: bool
|
|
|
90
|
|
|
91 dispatchable: bool
|
|
|
92
|
|
|
93 extensions: list[str] # All extensions that enable the handle
|
|
|
94
|
|
|
95 def __lt__(self, other):
|
|
|
96 return self.name < other.name
|
|
|
97
|
|
|
98 class ExternSync(Enum):
|
|
|
99 NONE = auto() # no externsync attribute
|
|
|
100 ALWAYS = auto() # externsync="true"
|
|
|
101 MAYBE = auto() # externsync="maybe"
|
|
|
102 SUBTYPE = auto() # externsync="param->member"
|
|
|
103 SUBTYPE_MAYBE = auto() # externsync="maybe:param->member"
|
|
|
104
|
|
|
105 @dataclass
|
|
|
106 class Param:
|
|
|
107 """<command/param>"""
|
|
|
108 name: str # ex) pCreateInfo, pAllocator, pBuffer
|
|
|
109 alias: str
|
|
|
110
|
|
|
111 # the "base type" - will not preserve the 'const' or pointer info
|
|
|
112 # ex) void, uint32_t, VkFormat, VkBuffer, etc
|
|
|
113 type: str
|
|
|
114 # the "full type" - will be cDeclaration without the type name
|
|
|
115 # ex) const void*, uint32_t, const VkFormat, VkBuffer*, etc
|
|
|
116 # For arrays, this will only display the type, fixedSizeArray can be used to get the length
|
|
|
117 fullType: str
|
|
|
118
|
|
|
119 noAutoValidity: bool
|
|
|
120
|
|
|
121 const: bool # type contains 'const'
|
|
|
122 length: (str | None) # the known length of pointer, will never be 'null-terminated'
|
|
|
123 nullTerminated: bool # If a UTF-8 string, it will be null-terminated
|
|
|
124 pointer: bool # type contains a pointer (include 'PFN' function pointers)
|
|
|
125 # Used to list how large an array of the type is
|
|
|
126 # ex) lineWidthRange is ['2']
|
|
|
127 # ex) memoryTypes is ['VK_MAX_MEMORY_TYPES']
|
|
|
128 # ex) VkTransformMatrixKHR:matrix is ['3', '4']
|
|
|
129 fixedSizeArray: list[str]
|
|
|
130
|
|
|
131 optional: bool
|
|
|
132 optionalPointer: bool # if type contains a pointer, is the pointer value optional
|
|
|
133
|
|
|
134 externSync: ExternSync
|
|
|
135 externSyncPointer: (str | None) # if type contains a pointer (externSync is SUBTYPE*),
|
|
|
136 # only a specific member is externally synchronized.
|
|
|
137
|
|
|
138 # C string of member, example:
|
|
|
139 # - const void* pNext
|
|
|
140 # - VkFormat format
|
|
|
141 # - VkStructureType sType
|
|
|
142 cDeclaration: str
|
|
|
143
|
|
|
144 def __lt__(self, other):
|
|
|
145 return self.name < other.name
|
|
|
146
|
|
|
147 class CommandScope(Enum):
|
|
|
148 NONE = auto()
|
|
|
149 INSIDE = auto()
|
|
|
150 OUTSIDE = auto()
|
|
|
151 BOTH = auto()
|
|
|
152
|
|
|
153 @dataclass
|
|
|
154 class Command:
|
|
|
155 """<command>"""
|
|
|
156 name: str # ex) vkCmdDraw
|
|
|
157 alias: (str | None) # Because commands are interfaces into layers/drivers, we need all command alias
|
|
|
158 protect: (str | None) # ex) 'VK_ENABLE_BETA_EXTENSIONS'
|
|
|
159
|
|
|
160 extensions: list[str] # All extensions that enable the struct
|
|
|
161 version: (Version | None) # None if Version 1.0
|
|
|
162
|
|
|
163 returnType: str # ex) void, VkResult, etc
|
|
|
164
|
|
|
165 params: list[Param] # Each parameter of the command
|
|
|
166
|
|
|
167 # Only one will be True, the other is False
|
|
|
168 instance: bool
|
|
|
169 device: bool
|
|
|
170
|
|
|
171 tasks: list[str] # ex) [ action, state, synchronization ]
|
|
|
172 queues: list[str] # ex) [ VK_QUEUE_GRAPHICS_BIT, VK_QUEUE_COMPUTE_BIT ]
|
|
|
173 allowNoQueues: bool # VK_KHR_maintenance9 allows some calls to be done with zero queues
|
|
|
174 successCodes: list[str] # ex) [ VK_SUCCESS, VK_INCOMPLETE ]
|
|
|
175 errorCodes: list[str] # ex) [ VK_ERROR_OUT_OF_HOST_MEMORY ]
|
|
|
176
|
|
|
177 # Shows support if command can be in a primary and/or secondary command buffer
|
|
|
178 primary: bool
|
|
|
179 secondary: bool
|
|
|
180
|
|
|
181 renderPass: CommandScope
|
|
|
182 videoCoding: CommandScope
|
|
|
183
|
|
|
184 implicitExternSyncParams: list[str]
|
|
|
185
|
|
|
186 legacy: (Legacy | None)
|
|
|
187
|
|
|
188 # C prototype string - ex:
|
|
|
189 # VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
|
|
|
190 # const VkInstanceCreateInfo* pCreateInfo,
|
|
|
191 # const VkAllocationCallbacks* pAllocator,
|
|
|
192 # VkInstance* pInstance);
|
|
|
193 cPrototype: str
|
|
|
194
|
|
|
195 # function pointer typedef - ex:
|
|
|
196 # typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)
|
|
|
197 # (const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
|
|
|
198 cFunctionPointer: str
|
|
|
199
|
|
|
200 def __lt__(self, other):
|
|
|
201 return self.name < other.name
|
|
|
202
|
|
|
203 @dataclass
|
|
|
204 class Member:
|
|
|
205 """<member>"""
|
|
|
206 name: str # ex) sType, pNext, flags, size, usage
|
|
|
207
|
|
|
208 # the "base type" - will not preserve the 'const' or pointer info
|
|
|
209 # ex) void, uint32_t, VkFormat, VkBuffer, etc
|
|
|
210 type: str
|
|
|
211 # the "full type" - will be cDeclaration without the type name
|
|
|
212 # ex) const void*, uint32_t, const VkFormat, VkBuffer*, etc
|
|
|
213 # For arrays, this will only display the type, fixedSizeArray can be used to get the length
|
|
|
214 fullType: str
|
|
|
215
|
|
|
216 noAutoValidity: bool
|
|
|
217 limitType: (str | None) # ex) 'max', 'bitmask', 'bits', 'min,mul'
|
|
|
218
|
|
|
219 const: bool # type contains 'const'
|
|
|
220 length: (str | None) # the known length of pointer, will never be 'null-terminated'
|
|
|
221 nullTerminated: bool # If a UTF-8 string, it will be null-terminated
|
|
|
222 pointer: bool # type contains a pointer (include 'PFN' function pointers)
|
|
|
223 # Used to list how large an array of the type is
|
|
|
224 # ex) lineWidthRange is ['2']
|
|
|
225 # ex) memoryTypes is ['VK_MAX_MEMORY_TYPES']
|
|
|
226 # ex) VkTransformMatrixKHR:matrix is ['3', '4']
|
|
|
227 fixedSizeArray: list[str]
|
|
|
228
|
|
|
229 optional: bool
|
|
|
230 optionalPointer: bool # if type contains a pointer, is the pointer value optional
|
|
|
231
|
|
|
232 externSync: ExternSync
|
|
|
233
|
|
|
234 # C string of member, example:
|
|
|
235 # - const void* pNext
|
|
|
236 # - VkFormat format
|
|
|
237 # - VkStructureType sType
|
|
|
238 cDeclaration: str
|
|
|
239
|
|
|
240 bitFieldWidth: (int | None) # bit width (only for bit field struct members)
|
|
|
241
|
|
|
242 # Selector for the union, this type determines the used data type in the union
|
|
|
243 selector: (str | None)
|
|
|
244 # Valid selections for the union member
|
|
|
245 selection: list[str]
|
|
|
246
|
|
|
247 def __lt__(self, other):
|
|
|
248 return self.name < other.name
|
|
|
249
|
|
|
250 @dataclass
|
|
|
251 class Struct:
|
|
|
252 """<type category="struct"> or <type category="union">"""
|
|
|
253 name: str # ex) VkImageSubresource2
|
|
|
254 aliases: list[str] # ex) ['VkImageSubresource2KHR', 'VkImageSubresource2EXT']
|
|
|
255
|
|
|
256 extensions: list[str] # All extensions that enable the struct
|
|
|
257 version: (Version | None) # None if Version 1.0
|
|
|
258 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
259
|
|
|
260 members: list[Member]
|
|
|
261
|
|
|
262 union: bool # Unions are just a subset of a Structs
|
|
|
263 returnedOnly: bool
|
|
|
264
|
|
|
265 sType: (str | None) # ex) VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
|
|
|
266 allowDuplicate: bool # can have a pNext point to itself
|
|
|
267
|
|
|
268 # These use to be list['Struct'] but some circular loops occur and cause
|
|
|
269 # pydevd warnings and made debugging slow (30 seconds to index a Struct)
|
|
|
270 extends: list[str] # Struct names that this struct extends
|
|
|
271 extendedBy: list[str] # Struct names that can be extended by this struct
|
|
|
272
|
|
|
273 # This field is only set for enum definitions coming from Video Std headers
|
|
|
274 videoStdHeader: (str | None) = None
|
|
|
275
|
|
|
276 def __lt__(self, other):
|
|
|
277 return self.name < other.name
|
|
|
278
|
|
|
279 @dataclass
|
|
|
280 class EnumField:
|
|
|
281 """<enum> of type enum"""
|
|
|
282 name: str # ex) VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT
|
|
|
283 aliases: list[str] # ex) ['VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT']
|
|
|
284
|
|
|
285 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
286
|
|
|
287 negative: bool # True if negative values are allowed (ex. VkResult)
|
|
|
288 value: int
|
|
|
289 valueStr: str # value as shown in spec (ex. "0", "2", "1000267000", "0x00000004")
|
|
|
290
|
|
|
291 # some fields are enabled from 2 extensions (ex) VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR)
|
|
|
292 extensions: list[str] # None if part of 1.0 core
|
|
|
293
|
|
|
294 def __lt__(self, other):
|
|
|
295 return self.name < other.name
|
|
|
296
|
|
|
297 @dataclass
|
|
|
298 class Enum:
|
|
|
299 """<enums> of type enum"""
|
|
|
300 name: str # ex) VkLineRasterizationMode
|
|
|
301 aliases: list[str] # ex) ['VkLineRasterizationModeKHR', 'VkLineRasterizationModeEXT']
|
|
|
302
|
|
|
303 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
304
|
|
|
305 bitWidth: int # 32 or 64 (currently all are 32, but field is to match with Bitmask)
|
|
|
306 returnedOnly: bool
|
|
|
307
|
|
|
308 fields: list[EnumField]
|
|
|
309
|
|
|
310 extensions: list[str] # None if part of 1.0 core
|
|
|
311 # Unique list of all extension that are involved in 'fields' (superset of 'extensions')
|
|
|
312 fieldExtensions: list[str]
|
|
|
313
|
|
|
314 # This field is only set for enum definitions coming from Video Std headers
|
|
|
315 videoStdHeader: (str | None) = None
|
|
|
316
|
|
|
317 def __lt__(self, other):
|
|
|
318 return self.name < other.name
|
|
|
319
|
|
|
320 @dataclass
|
|
|
321 class Flag:
|
|
|
322 """<enum> of type bitmask"""
|
|
|
323 name: str # ex) VK_ACCESS_2_SHADER_READ_BIT
|
|
|
324 aliases: str # ex) ['VK_ACCESS_2_SHADER_READ_BIT_KHR']
|
|
|
325
|
|
|
326 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
327
|
|
|
328 value: int
|
|
|
329 valueStr: str # value as shown in spec (ex. 0x00000000", "0x00000004", "0x0000000F", "0x800000000ULL")
|
|
|
330 multiBit: bool # if true, more than one bit is set (ex) VK_SHADER_STAGE_ALL_GRAPHICS)
|
|
|
331 zero: bool # if true, the value is zero (ex) VK_PIPELINE_STAGE_NONE)
|
|
|
332
|
|
|
333 # some fields are enabled from 2 extensions (ex) VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT)
|
|
|
334 extensions: list[str] # None if part of 1.0 core
|
|
|
335
|
|
|
336 def __lt__(self, other):
|
|
|
337 return self.name < other.name
|
|
|
338
|
|
|
339 @dataclass
|
|
|
340 class Bitmask:
|
|
|
341 """<enums> of type bitmask"""
|
|
|
342 name: str # ex) VkAccessFlagBits2
|
|
|
343 aliases: list[str] # ex) ['VkAccessFlagBits2KHR']
|
|
|
344
|
|
|
345 flagName: str # ex) VkAccessFlags2
|
|
|
346 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
347
|
|
|
348 bitWidth: int # 32 or 64
|
|
|
349 returnedOnly: bool
|
|
|
350
|
|
|
351 flags: list[Flag]
|
|
|
352
|
|
|
353 extensions: list[str] # None if part of 1.0 core
|
|
|
354 # Unique list of all extension that are involved in 'flag' (superset of 'extensions')
|
|
|
355 flagExtensions: list[str]
|
|
|
356
|
|
|
357 def __lt__(self, other):
|
|
|
358 return self.name < other.name
|
|
|
359
|
|
|
360 @dataclass
|
|
|
361 class Flags:
|
|
|
362 """<type> defining flags types"""
|
|
|
363 name: str # ex) VkAccessFlags2
|
|
|
364 aliases: list[str] # ex) [`VkAccessFlags2KHR`]
|
|
|
365
|
|
|
366 bitmaskName: (str | None) # ex) VkAccessFlagBits2
|
|
|
367 protect: (str | None) # ex) VK_ENABLE_BETA_EXTENSIONS
|
|
|
368
|
|
|
369 baseFlagsType: str # ex) VkFlags
|
|
|
370 bitWidth: int # 32 or 64
|
|
|
371 returnedOnly: bool
|
|
|
372
|
|
|
373 extensions: list[str] # None if part of 1.0 core
|
|
|
374
|
|
|
375 def __lt__(self, other):
|
|
|
376 return self.name < other.name
|
|
|
377
|
|
|
378 @dataclass
|
|
|
379 class Constant:
|
|
|
380 name: str # ex) VK_UUID_SIZE
|
|
|
381 type: str # ex) uint32_t, float
|
|
|
382 value: (int | float)
|
|
|
383 valueStr: str # value as shown in spec (ex. "(~0U)", "256U", etc)
|
|
|
384
|
|
|
385 # This field is only set for enum definitions coming from Video Std headers
|
|
|
386 videoStdHeader: (str | None) = None
|
|
|
387
|
|
|
388 @dataclass
|
|
|
389 class FormatComponent:
|
|
|
390 """<format/component>"""
|
|
|
391 type: str # ex) R, G, B, A, D, S, etc
|
|
|
392 bits: str # will be an INT or 'compressed'
|
|
|
393 numericFormat: str # ex) UNORM, SINT, etc
|
|
|
394 planeIndex: (int | None) # None if no planeIndex in format
|
|
|
395
|
|
|
396 @dataclass
|
|
|
397 class FormatPlane:
|
|
|
398 """<format/plane>"""
|
|
|
399 index: int
|
|
|
400 widthDivisor: int
|
|
|
401 heightDivisor: int
|
|
|
402 compatible: str
|
|
|
403
|
|
|
404 @dataclass
|
|
|
405 class Format:
|
|
|
406 """<format>"""
|
|
|
407 name: str
|
|
|
408 className: str
|
|
|
409 blockSize: int
|
|
|
410 texelsPerBlock: int
|
|
|
411 blockExtent: list[str]
|
|
|
412 packed: (int | None) # None == not-packed
|
|
|
413 chroma: (str | None)
|
|
|
414 compressed: (str | None)
|
|
|
415 components: list[FormatComponent] # <format/component>
|
|
|
416 planes: list[FormatPlane] # <format/plane>
|
|
|
417 spirvImageFormat: (str | None)
|
|
|
418
|
|
|
419 @dataclass
|
|
|
420 class SyncSupport:
|
|
|
421 """<syncsupport>"""
|
|
|
422 queues: list[str] # ex) [ VK_QUEUE_GRAPHICS_BIT, VK_QUEUE_COMPUTE_BIT ]
|
|
|
423 stages: list[Flag] # VkPipelineStageFlagBits2
|
|
|
424 max: bool # If this supports max values
|
|
|
425
|
|
|
426 @dataclass
|
|
|
427 class SyncEquivalent:
|
|
|
428 """<syncequivalent>"""
|
|
|
429 stages: list[Flag] # VkPipelineStageFlagBits2
|
|
|
430 accesses: list[Flag] # VkAccessFlagBits2
|
|
|
431 max: bool # If this equivalent to everything
|
|
|
432
|
|
|
433 @dataclass
|
|
|
434 class SyncStage:
|
|
|
435 """<syncstage>"""
|
|
|
436 flag: Flag # VkPipelineStageFlagBits2
|
|
|
437 support: SyncSupport
|
|
|
438 equivalent: SyncEquivalent
|
|
|
439
|
|
|
440 @dataclass
|
|
|
441 class SyncAccess:
|
|
|
442 """<syncaccess>"""
|
|
|
443 flag: Flag # VkAccessFlagBits2
|
|
|
444 support: SyncSupport
|
|
|
445 equivalent: SyncEquivalent
|
|
|
446
|
|
|
447 @dataclass
|
|
|
448 class SyncPipelineStage:
|
|
|
449 """<syncpipelinestage>"""
|
|
|
450 order: (str | None)
|
|
|
451 before: (str | None)
|
|
|
452 after: (str | None)
|
|
|
453 value: str
|
|
|
454
|
|
|
455 @dataclass
|
|
|
456 class SyncPipeline:
|
|
|
457 """<syncpipeline>"""
|
|
|
458 name: str
|
|
|
459 depends: list[str]
|
|
|
460 stages: list[SyncPipelineStage]
|
|
|
461
|
|
|
462 @dataclass
|
|
|
463 class SpirvEnables:
|
|
|
464 """What is needed to enable the SPIR-V element"""
|
|
|
465 version: (str | None)
|
|
|
466 extension: (str | None)
|
|
|
467 struct: (str | None)
|
|
|
468 feature: (str | None)
|
|
|
469 requires: (str | None)
|
|
|
470 property: (str | None)
|
|
|
471 member: (str | None)
|
|
|
472 value: (str | None)
|
|
|
473
|
|
|
474 @dataclass
|
|
|
475 class Spirv:
|
|
|
476 """<spirvextension> and <spirvcapability>"""
|
|
|
477 name: str
|
|
|
478 # Only one will be True, the other is False
|
|
|
479 extension: bool
|
|
|
480 capability: bool
|
|
|
481 enable: list[SpirvEnables]
|
|
|
482
|
|
|
483 @dataclass
|
|
|
484 class VideoRequiredCapabilities:
|
|
|
485 """<videorequirecapabilities>"""
|
|
|
486 struct: str # ex) VkVideoEncodeCapabilitiesKHR
|
|
|
487 member: str # ex) flags
|
|
|
488 value: str # ex) VK_VIDEO_ENCODE_CAPABILITY_QUANTIZATION_DELTA_MAP_BIT_KHR
|
|
|
489 # may contain XML boolean expressions ("+" means AND, "," means OR)
|
|
|
490
|
|
|
491 @dataclass
|
|
|
492 class VideoFormat:
|
|
|
493 """<videoformat>"""
|
|
|
494 name: str # ex) Decode Output
|
|
|
495 usage: str # ex) VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
|
|
|
496 # may contain XML boolean expressions ("+" means AND, "," means OR)
|
|
|
497
|
|
|
498 requiredCaps: list[VideoRequiredCapabilities]
|
|
|
499 properties: dict[str, str]
|
|
|
500
|
|
|
501 def __lt__(self, other):
|
|
|
502 return self.name < other.name
|
|
|
503
|
|
|
504 @dataclass
|
|
|
505 class VideoProfileMember:
|
|
|
506 """<videoprofilemember> and <videoprofile>"""
|
|
|
507 name: str
|
|
|
508 # Video profile struct member (value attribute of <videoprofile>) value as key,
|
|
|
509 # profile name substring (name attribute of <videoprofile>) as value
|
|
|
510 values: dict[str, str]
|
|
|
511
|
|
|
512 @dataclass
|
|
|
513 class VideoProfiles:
|
|
|
514 """<videoprofiles>"""
|
|
|
515 name: str
|
|
|
516 members: dict[str, VideoProfileMember]
|
|
|
517
|
|
|
518 @dataclass
|
|
|
519 class VideoCodec:
|
|
|
520 """<videocodec>"""
|
|
|
521 name: str # ex) H.264 Decode
|
|
|
522 value: (str | None) # If no video codec operation flag bit is associated with the codec
|
|
|
523 # then it is a codec category (e.g. decode, encode), not a specific codec
|
|
|
524
|
|
|
525 profiles: dict[str, VideoProfiles]
|
|
|
526 capabilities: dict[str, str]
|
|
|
527 formats: dict[str, VideoFormat]
|
|
|
528
|
|
|
529 def __lt__(self, other):
|
|
|
530 return self.name < other.name
|
|
|
531
|
|
|
532 @dataclass
|
|
|
533 class VideoStdHeader:
|
|
|
534 """<extension> in video.xml"""
|
|
|
535 name: str # ex) vulkan_video_codec_h264std_decode
|
|
|
536 version: (str | None) # ex) VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
|
|
|
537 # None if it is a shared common Video Std header
|
|
|
538
|
|
|
539 headerFile: str # ex) vk_video/vulkan_video_codec_h264std_decode.h
|
|
|
540
|
|
|
541 # Other Video Std headers that this one depends on
|
|
|
542 depends: list[str]
|
|
|
543
|
|
|
544 @dataclass
|
|
|
545 class VideoStd:
|
|
|
546 headers: dict[str, VideoStdHeader] = field(default_factory=dict, init=False)
|
|
|
547
|
|
|
548 enums: dict[str, Enum] = field(default_factory=dict, init=False)
|
|
|
549 structs: dict[str, Struct] = field(default_factory=dict, init=False)
|
|
|
550 constants: dict[str, Constant] = field(default_factory=dict, init=False)
|
|
|
551
|
|
|
552 # This is the global Vulkan Object that holds all the information from parsing the XML
|
|
|
553 # This class is designed so all generator scripts can use this to obtain data
|
|
|
554 @dataclass
|
|
|
555 class VulkanObject():
|
|
|
556 headerVersion: int = 0 # value of VK_HEADER_VERSION (ex. 345)
|
|
|
557 headerVersionComplete: str = '' # value of VK_HEADER_VERSION_COMPLETE (ex. '1.2.345' )
|
|
|
558
|
|
|
559 extensions: dict[str, Extension] = field(default_factory=dict, init=False)
|
|
|
560 versions: dict[str, Version] = field(default_factory=dict, init=False)
|
|
|
561
|
|
|
562 handles: dict[str, Handle] = field(default_factory=dict, init=False)
|
|
|
563 commands: dict[str, Command] = field(default_factory=dict, init=False)
|
|
|
564 structs: dict[str, Struct] = field(default_factory=dict, init=False)
|
|
|
565 enums: dict[str, Enum] = field(default_factory=dict, init=False)
|
|
|
566 bitmasks: dict[str, Bitmask] = field(default_factory=dict, init=False)
|
|
|
567 flags: dict[str, Flags] = field(default_factory=dict, init=False)
|
|
|
568 constants: dict[str, Constant] = field(default_factory=dict, init=False)
|
|
|
569 formats: dict[str, Format] = field(default_factory=dict, init=False)
|
|
|
570
|
|
|
571 syncStage: list[SyncStage] = field(default_factory=list, init=False)
|
|
|
572 syncAccess: list[SyncAccess] = field(default_factory=list, init=False)
|
|
|
573 syncPipeline: list[SyncPipeline] = field(default_factory=list, init=False)
|
|
|
574
|
|
|
575 spirv: list[Spirv] = field(default_factory=list, init=False)
|
|
|
576
|
|
|
577 # ex) [ xlib : VK_USE_PLATFORM_XLIB_KHR ]
|
|
|
578 platforms: dict[str, str] = field(default_factory=dict, init=False)
|
|
|
579 # list of all vendor Suffix names (KHR, EXT, etc. )
|
|
|
580 vendorTags: list[str] = field(default_factory=list, init=False)
|
|
|
581
|
|
|
582 # Video codec information from the vk.xml
|
|
|
583 videoCodecs: dict[str, VideoCodec] = field(default_factory=dict, init=False)
|
|
|
584
|
|
|
585 # Video Std header information from the video.xml
|
|
|
586 videoStd: (VideoStd | None) = None
|