winevulkan: Generate typedefs for aliased enums.
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com> Signed-off-by: Piers Daniell <pdaniell@nvidia.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1e41a38c3b
commit
da71d390d4
|
@ -335,11 +335,15 @@ class VkEnum(object):
|
|||
self.values = values
|
||||
self.required = False
|
||||
self.alias = alias
|
||||
self.aliased_by = []
|
||||
|
||||
@staticmethod
|
||||
def from_alias(enum, alias):
|
||||
name = enum.attrib.get("name")
|
||||
return VkEnum(name, alias.values, alias=alias)
|
||||
aliasee = VkEnum(name, alias.values, alias=alias)
|
||||
|
||||
alias.add_aliased_by(aliasee)
|
||||
return aliasee
|
||||
|
||||
@staticmethod
|
||||
def from_xml(enum):
|
||||
|
@ -386,18 +390,29 @@ class VkEnum(object):
|
|||
self.values.append(value)
|
||||
|
||||
def definition(self):
|
||||
if self.is_alias():
|
||||
return ""
|
||||
|
||||
text = "typedef enum {0}\n{{\n".format(self.name)
|
||||
|
||||
# Print values sorted, values can have been added in a random order.
|
||||
values = sorted(self.values, key=lambda value: value.value)
|
||||
for value in values:
|
||||
text += " {0},\n".format(value.definition())
|
||||
text += "}} {0};\n\n".format(self.name)
|
||||
text += "}} {0};\n".format(self.name)
|
||||
|
||||
for aliasee in self.aliased_by:
|
||||
text += "typedef {0} {1};\n".format(self.name, aliasee.name)
|
||||
|
||||
text += "\n"
|
||||
return text
|
||||
|
||||
def is_alias(self):
|
||||
return bool(self.alias)
|
||||
|
||||
def add_aliased_by(self, aliasee):
|
||||
self.aliased_by.append(aliasee)
|
||||
|
||||
|
||||
class VkEnumValue(object):
|
||||
def __init__(self, name, value, hex=False):
|
||||
|
|
|
@ -777,6 +777,7 @@ typedef enum VkChromaLocation
|
|||
VK_CHROMA_LOCATION_MIDPOINT = 1,
|
||||
VK_CHROMA_LOCATION_MAX_ENUM = 0x7fffffff,
|
||||
} VkChromaLocation;
|
||||
typedef VkChromaLocation VkChromaLocationKHR;
|
||||
|
||||
typedef enum VkCoarseSampleOrderTypeNV
|
||||
{
|
||||
|
@ -994,6 +995,7 @@ typedef enum VkDescriptorUpdateTemplateType
|
|||
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1,
|
||||
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 0x7fffffff,
|
||||
} VkDescriptorUpdateTemplateType;
|
||||
typedef VkDescriptorUpdateTemplateType VkDescriptorUpdateTemplateTypeKHR;
|
||||
|
||||
typedef enum VkDeviceGroupPresentModeFlagBitsKHR
|
||||
{
|
||||
|
@ -1061,6 +1063,7 @@ typedef enum VkExternalFenceFeatureFlagBits
|
|||
VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 0x00000002,
|
||||
VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalFenceFeatureFlagBits;
|
||||
typedef VkExternalFenceFeatureFlagBits VkExternalFenceFeatureFlagBitsKHR;
|
||||
|
||||
typedef enum VkExternalFenceHandleTypeFlagBits
|
||||
{
|
||||
|
@ -1070,6 +1073,7 @@ typedef enum VkExternalFenceHandleTypeFlagBits
|
|||
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000008,
|
||||
VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalFenceHandleTypeFlagBits;
|
||||
typedef VkExternalFenceHandleTypeFlagBits VkExternalFenceHandleTypeFlagBitsKHR;
|
||||
|
||||
typedef enum VkExternalMemoryFeatureFlagBits
|
||||
{
|
||||
|
@ -1078,6 +1082,7 @@ typedef enum VkExternalMemoryFeatureFlagBits
|
|||
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 0x00000004,
|
||||
VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalMemoryFeatureFlagBits;
|
||||
typedef VkExternalMemoryFeatureFlagBits VkExternalMemoryFeatureFlagBitsKHR;
|
||||
|
||||
typedef enum VkExternalMemoryHandleTypeFlagBits
|
||||
{
|
||||
|
@ -1092,6 +1097,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBits
|
|||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalMemoryHandleTypeFlagBits;
|
||||
typedef VkExternalMemoryHandleTypeFlagBits VkExternalMemoryHandleTypeFlagBitsKHR;
|
||||
|
||||
typedef enum VkExternalSemaphoreFeatureFlagBits
|
||||
{
|
||||
|
@ -1099,6 +1105,7 @@ typedef enum VkExternalSemaphoreFeatureFlagBits
|
|||
VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 0x00000002,
|
||||
VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalSemaphoreFeatureFlagBits;
|
||||
typedef VkExternalSemaphoreFeatureFlagBits VkExternalSemaphoreFeatureFlagBitsKHR;
|
||||
|
||||
typedef enum VkExternalSemaphoreHandleTypeFlagBits
|
||||
{
|
||||
|
@ -1109,6 +1116,7 @@ typedef enum VkExternalSemaphoreHandleTypeFlagBits
|
|||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000010,
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkExternalSemaphoreHandleTypeFlagBits;
|
||||
typedef VkExternalSemaphoreHandleTypeFlagBits VkExternalSemaphoreHandleTypeFlagBitsKHR;
|
||||
|
||||
typedef enum VkFenceCreateFlagBits
|
||||
{
|
||||
|
@ -1121,6 +1129,7 @@ typedef enum VkFenceImportFlagBits
|
|||
VK_FENCE_IMPORT_TEMPORARY_BIT = 0x00000001,
|
||||
VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkFenceImportFlagBits;
|
||||
typedef VkFenceImportFlagBits VkFenceImportFlagBitsKHR;
|
||||
|
||||
typedef enum VkFilter
|
||||
{
|
||||
|
@ -1597,6 +1606,7 @@ typedef enum VkMemoryAllocateFlagBits
|
|||
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = 0x00000004,
|
||||
VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkMemoryAllocateFlagBits;
|
||||
typedef VkMemoryAllocateFlagBits VkMemoryAllocateFlagBitsKHR;
|
||||
|
||||
typedef enum VkMemoryHeapFlagBits
|
||||
{
|
||||
|
@ -1672,6 +1682,7 @@ typedef enum VkPeerMemoryFeatureFlagBits
|
|||
VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 0x00000008,
|
||||
VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkPeerMemoryFeatureFlagBits;
|
||||
typedef VkPeerMemoryFeatureFlagBits VkPeerMemoryFeatureFlagBitsKHR;
|
||||
|
||||
typedef enum VkPerformanceConfigurationTypeINTEL
|
||||
{
|
||||
|
@ -1839,6 +1850,7 @@ typedef enum VkPointClippingBehavior
|
|||
VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1,
|
||||
VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 0x7fffffff,
|
||||
} VkPointClippingBehavior;
|
||||
typedef VkPointClippingBehavior VkPointClippingBehaviorKHR;
|
||||
|
||||
typedef enum VkPolygonMode
|
||||
{
|
||||
|
@ -2058,6 +2070,7 @@ typedef enum VkSamplerYcbcrModelConversion
|
|||
VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4,
|
||||
VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 0x7fffffff,
|
||||
} VkSamplerYcbcrModelConversion;
|
||||
typedef VkSamplerYcbcrModelConversion VkSamplerYcbcrModelConversionKHR;
|
||||
|
||||
typedef enum VkSamplerYcbcrRange
|
||||
{
|
||||
|
@ -2065,6 +2078,7 @@ typedef enum VkSamplerYcbcrRange
|
|||
VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1,
|
||||
VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 0x7fffffff,
|
||||
} VkSamplerYcbcrRange;
|
||||
typedef VkSamplerYcbcrRange VkSamplerYcbcrRangeKHR;
|
||||
|
||||
typedef enum VkScopeNV
|
||||
{
|
||||
|
@ -2080,6 +2094,7 @@ typedef enum VkSemaphoreImportFlagBits
|
|||
VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 0x00000001,
|
||||
VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7fffffff,
|
||||
} VkSemaphoreImportFlagBits;
|
||||
typedef VkSemaphoreImportFlagBits VkSemaphoreImportFlagBitsKHR;
|
||||
|
||||
typedef enum VkSemaphoreTypeKHR
|
||||
{
|
||||
|
@ -2573,6 +2588,7 @@ typedef enum VkTessellationDomainOrigin
|
|||
VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1,
|
||||
VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 0x7fffffff,
|
||||
} VkTessellationDomainOrigin;
|
||||
typedef VkTessellationDomainOrigin VkTessellationDomainOriginKHR;
|
||||
|
||||
typedef enum VkToolPurposeFlagBitsEXT
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue