("VK_MAX_MEMORY_HEAPS", "size_t"),
("VK_MAX_DESCRIPTION_SIZE", "size_t"),
("VK_MAX_DEVICE_GROUP_SIZE", "size_t"),
- ("VK_ATTACHMENT_UNUSED", "deUint32"),
- ("VK_SUBPASS_EXTERNAL", "deUint32"),
- ("VK_QUEUE_FAMILY_IGNORED", "deUint32"),
- ("VK_QUEUE_FAMILY_EXTERNAL", "deUint32"),
- ("VK_REMAINING_MIP_LEVELS", "deUint32"),
- ("VK_REMAINING_ARRAY_LAYERS", "deUint32"),
+ ("VK_ATTACHMENT_UNUSED", "uint32_t"),
+ ("VK_SUBPASS_EXTERNAL", "uint32_t"),
+ ("VK_QUEUE_FAMILY_IGNORED", "uint32_t"),
+ ("VK_QUEUE_FAMILY_EXTERNAL", "uint32_t"),
+ ("VK_REMAINING_MIP_LEVELS", "uint32_t"),
+ ("VK_REMAINING_ARRAY_LAYERS", "uint32_t"),
("VK_WHOLE_SIZE", "vk::VkDeviceSize"),
("VK_TRUE", "vk::VkBool32"),
("VK_FALSE", "vk::VkBool32"),
PLATFORM_TYPES = [
# VK_KHR_xlib_surface
(["Display","*"], ["XlibDisplayPtr"], "void*"),
- (["Window"], ["XlibWindow"], "deUintptr",),
- (["VisualID"], ["XlibVisualID"], "deUint32"),
+ (["Window"], ["XlibWindow"], "uintptr_t",),
+ (["VisualID"], ["XlibVisualID"], "uint32_t"),
# VK_KHR_xcb_surface
(["xcb_connection_t", "*"], ["XcbConnectionPtr"], "void*"),
- (["xcb_window_t"], ["XcbWindow"], "deUintptr"),
- (["xcb_visualid_t"], ["XcbVisualid"], "deUint32"),
+ (["xcb_window_t"], ["XcbWindow"], "uintptr_t"),
+ (["xcb_visualid_t"], ["XcbVisualid"], "uint32_t"),
# VK_KHR_wayland_surface
(["struct", "wl_display","*"], ["WaylandDisplayPtr"], "void*"),
# VK_EXT_acquire_xlib_display
(["RROutput"], ["RROutput"], "void*"),
- (["zx_handle_t"], ["zx_handle_t"], "deInt32"),
- (["GgpFrameToken"], ["GgpFrameToken"], "deInt32"),
- (["GgpStreamDescriptor"], ["GgpStreamDescriptor"], "deInt32"),
+ (["zx_handle_t"], ["zx_handle_t"], "int32_t"),
+ (["GgpFrameToken"], ["GgpFrameToken"], "int32_t"),
+ (["GgpStreamDescriptor"], ["GgpStreamDescriptor"], "int32_t"),
(["CAMetalLayer"], ["CAMetalLayer"], "void*"),
]
PLATFORM_TYPE_NAMESPACE = "pt"
TYPE_SUBSTITUTIONS = [
- ("uint8_t", "deUint8"),
- ("uint16_t", "deUint16"),
- ("uint32_t", "deUint32"),
- ("uint64_t", "deUint64"),
- ("int8_t", "deInt8"),
- ("int16_t", "deInt16"),
- ("int32_t", "deInt32"),
- ("int64_t", "deInt64"),
- ("bool32_t", "deUint32"),
- ("size_t", "deUintptr"),
-
# Platform-specific
- ("DWORD", "deUint32"),
+ ("DWORD", "uint32_t"),
("HANDLE*", PLATFORM_TYPE_NAMESPACE + "::" + "Win32Handle*"),
]
name = name.replace("VULKAN_11_PROPERTIES", "VULKAN_1_1_PROPERTIES")
name = name.replace("VULKAN_12_FEATURES", "VULKAN_1_2_FEATURES")
name = name.replace("VULKAN_12_PROPERTIES", "VULKAN_1_2_PROPERTIES")
+ name = name.replace("VULKAN_13_FEATURES", "VULKAN_1_3_FEATURES")
+ name = name.replace("VULKAN_13_PROPERTIES", "VULKAN_1_3_PROPERTIES")
name = name.replace("INT_8_", "INT8_")
name = name.replace("AABBNV", "AABB_NV")
name = name.replace("_H_264_", "_H264_")
definitionsByName = {definition.name: definition for definition in allDefinitions}
for extensionName, extensionSrc in splitSrc:
- definitions = [Definition("deUint32", v.getInHex(), parsePreprocDefinedValueOptional(extensionSrc, v.getInHex())) for v in versions]
+ definitions = [Definition("uint32_t", v.getInHex(), parsePreprocDefinedValueOptional(extensionSrc, v.getInHex())) for v in versions]
definitions.extend([Definition(type, name, parsePreprocDefinedValueOptional(extensionSrc, name)) for name, type in DEFINITIONS])
definitions = [definition for definition in definitions if definition.value != None]
additionalDefinitions = parseDefinitions(extensionName, extensionSrc)
functions = parseFunctions(extensionSrc)
compositeTypes = parseCompositeTypes(extensionSrc)
rawEnums = parseEnums(extensionSrc)
- bitfieldNames = parseBitfieldNames(extensionSrc)
+ bitfieldNames = parse32bitBitfieldNames(extensionSrc)
typedefs = parseTypedefs(extensionSrc)
enumBitfieldNames = [getBitEnumNameForBitfield(name) for name in bitfieldNames]
enums = [enum for enum in rawEnums if enum.name not in enumBitfieldNames]
extensions.append(Extension(extensionName, extHandles, extEnums, extBitfields, extCompositeTypes, extFunctions, extDefinitions, additionalDefinitions, typedefs, extCoreVersion))
return extensions
-def parseBitfieldNames (src):
+def parse32bitBitfieldNames (src):
ptrn = r'typedef\s+VkFlags\s(' + IDENT_PTRN + r')\s*;'
matches = re.findall(ptrn, src)
def parseAPI (src):
versionsData = parseVersions(src)
versions = [Version((v[2], v[3], 0)) for v in versionsData]
- definitions = [Definition("deUint32", v.getInHex(), parsePreprocDefinedValue(src, v.getInHex())) for v in versions] +\
+ definitions = [Definition("uint32_t", v.getInHex(), parsePreprocDefinedValue(src, v.getInHex())) for v in versions] +\
[Definition(type, name, parsePreprocDefinedValue(src, name)) for name, type in DEFINITIONS]
handles = parseHandles(src)
rawEnums = parseEnums(src)
- bitfieldNames = parseBitfieldNames(src)
+ bitfieldNames = parse32bitBitfieldNames(src)
bitfieldEnums = set([getBitEnumNameForBitfield(n) for n in bitfieldNames if getBitEnumNameForBitfield(n) in [enum.name for enum in rawEnums]])
bitfield64Names = parse64bitBitfieldNames(src)
bitfields64 = parse64bitBitfieldValues(src, bitfield64Names)
populateAliasesWithTypedefs(compositeTypes, src)
populateAliasesWithTypedefs(enums, src)
populateAliasesWithTypedefs(bitfields, src)
+ populateAliasesWithTypedefs(bitfields64, src)
populateAliasesWithTypedefs(handles, src)
for enum in enums:
yield "enum %s" % enum.name
yield "{"
- lines = ["\t%s\t= %s," % v for v in enum.values]
+ lines = []
if areEnumValuesLinear(enum):
- lastItem = "\t%s_LAST," % getEnumValuePrefix(enum)
- if parseInt(enum.values[-1][1]) == 0x7FFFFFFF:
- # if last enum item is *_MAX_ENUM then we need to make sure
- # it stays last entry also if we append *_LAST to generated
- # source (without this value of *_LAST won't be correct)
- lines.insert(-1, lastItem)
- else:
- lines.append(lastItem)
+ hasMaxItem = parseInt(enum.values[-1][1]) == 0x7FFFFFFF
+
+ values = enum.values[:-1] if hasMaxItem else enum.values
+ lastItem = "\t%s_LAST," % getEnumValuePrefix(enum)
+
+ # linear values first, followed by *_LAST
+ lines += ["\t%s\t= %s," % v for v in values if v[1][:2] != "VK"]
+ lines.append(lastItem)
+
+ # equivalence enums and *_MAX_ENUM
+ lines += ["\t%s\t= %s," % v for v in values if v[1][:2] == "VK"]
+ if hasMaxItem:
+ lines.append("\t%s\t= %s," % enum.values[-1])
+ else:
+ lines += ["\t%s\t= %s," % v for v in enum.values]
for line in indentLines(lines):
yield line
for line in indentLines(["\t%s\t= %s," % v for v in bitfield.values]):
yield line
yield "};"
- yield "typedef deUint32 %s;" % bitfield.name
+ yield "typedef uint32_t %s;" % bitfield.name
def genBitfield64Src (bitfield64):
- yield "typedef deUint64 %s;" % bitfield64.name
+ yield "typedef uint64_t %s;" % bitfield64.name
if len(bitfield64.values) > 0:
ptrn = "static const " + bitfield64.name + " %s\t= %s;"
for line in indentLines([ptrn % v for v in bitfield64.values]):
yield "typedef %s %s;" % (bitfield2.name, bitfield.name)
yield ""
- for bitfield64 in api.bitfields64:
- for line in genBitfield64Src(bitfield64):
- yield line
+ for bitfield in api.bitfields64:
+ if not bitfield.isAlias:
+ for line in genBitfield64Src(bitfield):
+ yield line
+ else:
+ for bitfield2 in api.bitfields64:
+ if bitfield2.alias == bitfield:
+ yield "typedef %s %s;" % (bitfield2.name, bitfield.name)
+ yield ""
- for line in indentLines(["VK_DEFINE_PLATFORM_TYPE(%s,\t%s);" % (s[0], c) for n, s, c in PLATFORM_TYPES]):
+ for line in indentLines(["VK_DEFINE_PLATFORM_TYPE(%s,\t%s)" % (s[0], c) for n, s, c in PLATFORM_TYPES]):
yield line
for ext in api.extensions:
singleDimensional = not '][' in member.arraySize
if member.name in ["extensionName", "deviceName", "layerName", "description"]:
valFmt = "(const char*)value.%s" % member.name
- elif singleDimensional and (member.getType() == 'char' or member.getType() == 'deUint8'):
+ elif singleDimensional and (member.getType() == 'char' or member.getType() == 'uint8_t'):
newLine = "'\\n' << "
valFmt = "tcu::formatArray(tcu::Format::HexIterator<%s>(DE_ARRAY_BEGIN(value.%s)), tcu::Format::HexIterator<%s>(DE_ARRAY_END(value.%s)))" % (member.getType(), member.name, member.getType(), member.name)
else:
driverIdsString.append("static const struct\n"
"{\n"
"\tstd::string driver;\n"
- "\tdeUint32 id;\n"
+ "\tuint32_t id;\n"
"} driverIds [] =\n"
"{")
lines = addVersionDefines(versionSet) + [
"",
- "void getCoreDeviceExtensionsImpl (deUint32 coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(deviceMap) != 0 else ""),
+ "void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(deviceMap) != 0 else ""),
"{"] + writeExtensionsForVersions(deviceMap) + [
"}",
"",
- "void getCoreInstanceExtensionsImpl (deUint32 coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(instanceMap) != 0 else ""),
+ "void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(instanceMap) != 0 else ""),
"{"] + writeExtensionsForVersions(instanceMap) + [
"}",
""] + removeVersionDefines(versionSet)
isFirstWrite = True
dg_list = [] # Device groups functions need special casing, as Vulkan 1.0 keeps them in VK_KHR_device_groups whereas 1.1 moved them into VK_KHR_swapchain
if functionType == Function.TYPE_INSTANCE:
- yield 'void getInstanceExtensionFunctions (deUint32 apiVersion, ::std::string extName, ::std::vector<const char*>& functions)\n{'
+ yield 'void getInstanceExtensionFunctions (uint32_t apiVersion, ::std::string extName, ::std::vector<const char*>& functions)\n{'
dg_list = ["vkGetPhysicalDevicePresentRectanglesKHR"]
elif functionType == Function.TYPE_DEVICE:
- yield 'void getDeviceExtensionFunctions (deUint32 apiVersion, ::std::string extName, ::std::vector<const char*>& functions)\n{'
+ yield 'void getDeviceExtensionFunctions (uint32_t apiVersion, ::std::string extName, ::std::vector<const char*>& functions)\n{'
dg_list = ["vkGetDeviceGroupPresentCapabilitiesKHR", "vkGetDeviceGroupSurfacePresentModesKHR", "vkAcquireNextImage2KHR"]
for ext in api.extensions:
funcNames = []
"",
"typedef ::std::pair<const char*, FunctionOrigin> FunctionInfo;",
"typedef ::std::vector<FunctionInfo> FunctionInfosList;",
- "typedef ::std::map<deUint32, FunctionInfosList> ApisMap;",
+ "typedef ::std::map<uint32_t, FunctionInfosList> ApisMap;",
"",
"void initApisMap (ApisMap& apis)",
"{",
" apis.clear();"] + [
- " apis.insert(::std::pair<deUint32, FunctionInfosList>(" + str(v) + ", FunctionInfosList()));" for v in api.versions] + [
+ " apis.insert(::std::pair<uint32_t, FunctionInfosList>(" + str(v) + ", FunctionInfosList()));" for v in api.versions] + [
""]
apiVersions = []
# this is not posible to determine from vulkan_core.h, if new feature structures
# are added they should be manualy added to this list
testedStructures = [
- 'VkPhysicalDeviceConditionalRenderingFeaturesEXT',
- 'VkPhysicalDeviceScalarBlockLayoutFeatures',
- 'VkPhysicalDevicePerformanceQueryFeaturesKHR',
- 'VkPhysicalDevice16BitStorageFeatures',
- 'VkPhysicalDeviceMultiviewFeatures',
- 'VkPhysicalDeviceProtectedMemoryFeatures',
- 'VkPhysicalDeviceSamplerYcbcrConversionFeatures',
- 'VkPhysicalDeviceVariablePointersFeatures',
+ 'VkPhysicalDevice4444FormatsFeaturesEXT',
'VkPhysicalDevice8BitStorageFeatures',
- 'VkPhysicalDeviceShaderAtomicInt64Features',
- 'VkPhysicalDeviceShaderFloat16Int8Features',
+ 'VkPhysicalDevice16BitStorageFeatures',
+ 'VkPhysicalDeviceAccelerationStructureFeaturesKHR',
+ 'VkPhysicalDeviceASTCDecodeFeaturesEXT',
+ 'VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT',
'VkPhysicalDeviceBufferDeviceAddressFeaturesEXT',
'VkPhysicalDeviceBufferDeviceAddressFeatures',
+ 'VkPhysicalDeviceConditionalRenderingFeaturesEXT',
+ 'VkPhysicalDeviceCustomBorderColorFeaturesEXT',
+ 'VkPhysicalDeviceColorWriteEnableFeaturesEXT',
'VkPhysicalDeviceDescriptorIndexingFeatures',
- 'VkPhysicalDeviceTimelineSemaphoreFeatures',
+ 'VkPhysicalDeviceDepthClipEnableFeaturesEXT',
+ 'VkPhysicalDeviceDynamicRenderingFeatures',
+ 'VkPhysicalDeviceExtendedDynamicStateFeaturesEXT',
+ 'VkPhysicalDeviceExtendedDynamicState2FeaturesEXT',
'VkPhysicalDeviceFragmentDensityMapFeaturesEXT',
'VkPhysicalDeviceFragmentDensityMap2FeaturesEXT',
+ 'VkPhysicalDeviceFragmentShadingRateFeaturesKHR',
+ 'VkPhysicalDeviceGlobalPriorityQueryFeaturesEXT',
+ 'VkPhysicalDeviceInlineUniformBlockFeatures',
+ 'VkPhysicalDeviceIndexTypeUint8FeaturesEXT',
+ 'VkPhysicalDeviceImagelessFramebufferFeatures',
+ 'VkPhysicalDeviceImageRobustnessFeatures',
+ 'VkPhysicalDeviceHostQueryResetFeatures',
+ 'VkPhysicalDeviceLineRasterizationFeaturesEXT',
+ 'VkPhysicalDeviceMaintenance4Features',
+ 'VkPhysicalDeviceMultiviewFeatures',
+ 'VkPhysicalDeviceMultiDrawFeaturesEXT',
+ 'VkPhysicalDeviceMemoryPriorityFeaturesEXT',
+ 'VkPhysicalDeviceDeviceMemoryReportFeaturesEXT',
+ 'VkPhysicalDevicePerformanceQueryFeaturesKHR',
+ 'VkPhysicalDevicePipelineCreationCacheControlFeatures',
+ 'VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR',
+ 'VkPhysicalDevicePresentIdFeaturesKHR',
+ 'VkPhysicalDevicePresentWaitFeaturesKHR',
+ 'VkPhysicalDeviceProtectedMemoryFeatures',
+ 'VkPhysicalDeviceProvokingVertexFeaturesEXT',
+ 'VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT',
+ 'VkPhysicalDevicePrivateDataFeatures',
+ 'VkPhysicalDeviceRayTracingPipelineFeaturesKHR',
+ 'VkPhysicalDeviceRayQueryFeaturesKHR',
+ 'VkPhysicalDeviceRobustness2FeaturesEXT',
+ 'VkPhysicalDeviceSamplerYcbcrConversionFeatures',
+ 'VkPhysicalDeviceScalarBlockLayoutFeatures',
+ 'VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures',
+ 'VkPhysicalDeviceShaderAtomicInt64Features',
+ 'VkPhysicalDeviceShaderAtomicFloatFeaturesEXT',
+ 'VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT',
+ 'VkPhysicalDeviceShaderFloat16Int8Features',
+ 'VkPhysicalDeviceShaderClockFeaturesKHR',
+ 'VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures',
+ 'VkPhysicalDeviceShaderDrawParametersFeatures',
+ 'VkPhysicalDeviceShaderIntegerDotProductFeatures',
'VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR',
+ 'VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures',
+ 'VkPhysicalDeviceShaderTerminateInvocationFeatures',
+ 'VkPhysicalDeviceSubgroupSizeControlFeatures',
+ 'VkPhysicalDeviceSynchronization2Features',
+ 'VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT',
+ 'VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT',
+ 'VkPhysicalDeviceTextureCompressionASTCHDRFeatures',
+ 'VkPhysicalDeviceTimelineSemaphoreFeatures',
+ 'VkPhysicalDeviceTransformFeedbackFeaturesEXT',
+ 'VkPhysicalDeviceUniformBufferStandardLayoutFeatures',
+ 'VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR',
+ 'VkPhysicalDeviceVariablePointersFeatures',
+ 'VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT',
+ 'VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT',
+ 'VkPhysicalDeviceVulkanMemoryModelFeaturesKHR',
+ 'VkPhysicalDeviceYcbcrImageArraysFeaturesEXT',
+ 'VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT',
+ 'VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures',
]
+
# helper class used to encapsulate all data needed during generation
class StructureDetail:
def __init__ (self, name):
# VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT
# but mostly they are not:
# VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES
- if (nameResult.group(1) == 'FragmentDensityMap2'):
- nameSplitUp = ['FRAGMENT', 'DENSITY', 'MAP', '2', 'FEATURES']
- else:
+ specialCaseDict = {
+ 'FragmentDensityMap2' : ['FRAGMENT', 'DENSITY', 'MAP', '2'],
+ 'Ycbcr2Plane444Formats' : ['YCBCR', '2', 'PLANE', '444', 'FORMATS'],
+ 'ASTCDecode' : ['ASTC', 'DECODE'],
+ '4444Formats' : ['4444', 'FORMATS'],
+ 'TextureCompressionASTCHDR' : ['TEXTURE', 'COMPRESSION', 'ASTC', 'HDR'],
+ 'Synchronization2' : ['SYNCHRONIZATION', '2'],
+ 'ShaderAtomicFloat2' : ['SHADER', 'ATOMIC', 'FLOAT', '2'],
+ 'Robustness2' : ['ROBUSTNESS', '2'],
+ 'Maintenance4' : ['MAINTENANCE', '4'],
+ 'ExtendedDynamicState2' : ['EXTENDED', 'DYNAMIC', 'STATE', '2'],
+ }
+ nameSplitUp = specialCaseDict.get(nameResult.group(1))
+ if nameSplitUp == None:
nameSplit = re.findall(r'[1-9A-Z]+(?:[a-z1-9]+|[A-Z]*(?=[A-Z]|$))', nameResult.group(1))
nameSplitUp = map(str.upper, nameSplit)
- nameSplitUp = list(nameSplitUp) + ['FEATURES']
+ nameSplitUp = list(nameSplitUp) + ['FEATURES']
# check if there is extension suffix
if (len(nameResult.group(2)) != 0):
nameSplitUp.append(nameResult.group(2))
verifyStructures = []
for index, structureDetail in enumerate(testedStructureDetail):
# create two instances of each structure
- nameSpacing = '\t' * int((55 - len(structureDetail.name)) / 4)
+ nameSpacing = '\t' * int((67 - len(structureDetail.name)) / 4)
structureDefinitions.append(structureDetail.name + nameSpacing + structureDetail.instanceName + '[count];')
# create flags that check if proper extension or vulkan version is available
condition = ''
condition = ' checkExtension(properties, "' + extension + '")'
if major is not None:
if condition != '':
- condition += '\t' * int((39 - len(extension)) / 4) + '|| '
+ condition += '\t' * int((47 - len(extension)) / 4) + '|| '
else:
- condition += '\t' * 17 + ' '
+ condition += '\t' * 19 + ' '
condition += 'context.contextSupports(vk::ApiVersion(' + str(major) + ', ' + str(structureDetail.minor) + ', 0))'
condition += ';'
- nameSpacing = '\t' * int((40 - len(structureDetail.flagName)) / 4)
+ nameSpacing = '\t' * int((48 - len(structureDetail.flagName)) / 4)
featureEnabledFlags.append('const bool ' + structureDetail.flagName + nameSpacing + '=' + condition)
# clear memory of each structure
- nameSpacing = '\t' * int((43 - len(structureDetail.instanceName)) / 4)
+ nameSpacing = '\t' * int((51 - len(structureDetail.instanceName)) / 4)
clearStructures.append('\tdeMemset(&' + structureDetail.instanceName + '[ndx],' + nameSpacing + '0xFF * ndx, sizeof(' + structureDetail.name + '));')
# construct structure chain
nextInstanceName = 'DE_NULL';
sType = "SCISSOR_EXCLUSIVE"
elif sType == "ASTC_DECODE":
sType = "ASTC_DECODE_MODE"
- if sType in {'VULKAN_1_1', 'VULKAN_1_2'}:
+ elif sType == "MAINTENANCE_4":
+ sType = "MAINTENANCE4"
+ elif sType == "YCBCR_2_PLANE_444_FORMATS":
+ sType = "YCBCR_2PLANE_444_FORMATS"
+ elif sType in {'VULKAN_1_1', 'VULKAN_1_2', 'VULKAN_1_3'}:
continue
# end handling special cases
ptrnExtensionName = r'^\s*#define\s+(\w+' + sSuffix + '_' + sType + '_EXTENSION_NAME).+$'
defs = []
for sType, sSuffix in matches:
# handle special cases
- if sType in {'VULKAN_1_1', 'VULKAN_1_2', 'GROUP', 'MEMORY_BUDGET', 'MEMORY', 'TOOL'}:
+ if sType in {'VULKAN_1_1', 'VULKAN_1_2', 'VULKAN_1_3', 'GROUP', 'MEMORY_BUDGET', 'MEMORY', 'TOOL'}:
continue
# there are cases like VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD
# where 2 is after PROPERTIES - to handle this we need to split suffix to two parts
extType = sType
if extType == "MAINTENANCE_3":
extType = "MAINTENANCE3"
+ elif extType == "MAINTENANCE_4":
+ extType = "MAINTENANCE4"
elif extType == "DISCARD_RECTANGLE":
extType = "DISCARD_RECTANGLES"
elif extType == "DRIVER":
sType = "EXCLUSIVE_SCISSOR"
elif sType == "ASTC_DECODE_MODE":
sType = "ASTC_DECODE"
+ elif sType == "MAINTENANCE4":
+ sType = "MAINTENANCE_4"
+ elif sType == "YCBCR_2PLANE_444_FORMATS":
+ sType = "YCBCR_2_PLANE_444_FORMATS"
# end handling special cases
# construct makeFeatureDesc template function definitions
sTypeName = "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_{0}_FEATURES{1}".format(sType, sVerSuffix + sExtSuffix)
"{{ return FeatureDesc{{{1}, {2}, {3}, {4}}}; }}".format(extStruct, sTypeName, extensionNameDefinition, specVer, len(dfDefs)-idx))
# construct CreateFeatureStruct wrapper block
featureStructWrappers.append("\t{{ createFeatureStructWrapper<{0}>, {1}, {2} }},".format(extStruct, extensionNameDefinition, specVer))
- # construct method that will check if structure sType is part of blob
- blobChecker = "bool isPartOfBlobFeatures (VkStructureType sType)\n{\n" \
- "\tconst std::vector<VkStructureType> sTypeVect =" \
+ # construct function that will check for which vk version structure sType is part of blob
+ blobChecker = "deUint32 getBlobFeaturesVersion (VkStructureType sType)\n{\n" \
+ "\tconst std::map<VkStructureType, deUint32> sTypeBlobMap\n" \
"\t{\n"
# iterate over blobs with list of structures
for blobName in sorted(blobStructs.keys()):
# handle special cases
if sType == "SCISSOR_EXCLUSIVE":
sType = "EXCLUSIVE_SCISSOR"
+ elif sType == "MAINTENANCE4":
+ sType = "MAINTENANCE_4"
# end handling special cases
sTypeName = "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_{0}_FEATURES{1}".format(sType, sSuffix)
- blobChecker += "\t\t{0},\n".format(sTypeName)
- blobChecker += "\t};\n" \
- "\treturn de::contains(sTypeVect.begin(), sTypeVect.end(), sType);\n" \
+ tabs = "\t" * int((88 - len(sTypeName)) / 4)
+ blobChecker += "\t\t{{ {0},{1}VK_API_VERSION_{2}_{3} }},\n".format(sTypeName, tabs, blobName[0], blobName[1])
+ blobChecker += "\t};\n\n" \
+ "\tauto it = sTypeBlobMap.find(sType);\n" \
+ "\tif(it == sTypeBlobMap.end())\n" \
+ "\t\treturn 0;\n" \
+ "\treturn it->second;\n" \
"}\n"
# combine all definition lists
stream = [
stream.append('\n')
stream.extend(makeFeatureDescDefinitions)
stream.append('\n')
- stream.append('static const FeatureStructCreationData featureStructCreationArray[] =\n{')
+ stream.append('static const FeatureStructCreationData featureStructCreationArray[]\n{')
stream.extend(featureStructWrappers)
stream.append('};\n')
stream.append(blobChecker)
"{{ return PropertyDesc{{{1}, {2}, {3}, {4}}}; }}".format(extStruct, sTypeName, extensionNameDefinition, specVer, len(dpDefs)-idx))
# construct CreateProperty struct wrapper block
propertyStructWrappers.append("\t{{ createPropertyStructWrapper<{0}>, {1}, {2} }},".format(extStruct, extensionNameDefinition, specVer))
- # construct method that will check if structure sType is part of blob
- blobChecker = "bool isPartOfBlobProperties (VkStructureType sType)\n{\n" \
- "\tconst std::vector<VkStructureType> sTypeVect =" \
+ # construct method that will check if structure sType is part of blob
+ blobChecker = "deUint32 getBlobPropertiesVersion (VkStructureType sType)\n{\n" \
+ "\tconst std::map<VkStructureType, deUint32> sTypeBlobMap\n" \
"\t{\n"
# iterate over blobs with list of structures
for blobName in sorted(blobStructs.keys()):
sType = structDef[0]
sSuffix = structDef[1] + structDef[2]
sTypeName = "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_{0}_PROPERTIES{1}".format(sType, sSuffix)
- blobChecker += "\t\t{0},\n".format(sTypeName)
- blobChecker += "\t};\n" \
- "\treturn de::contains(sTypeVect.begin(), sTypeVect.end(), sType);\n" \
+ tabs = "\t" * int((76 - len(sTypeName)) / 4)
+ blobChecker += "\t\t{{ {0},{1}VK_API_VERSION_{2}_{3} }},\n".format(sTypeName, tabs, blobName[0], blobName[1])
+ blobChecker += "\t};\n\n" \
+ "\tauto it = sTypeBlobMap.find(sType);\n" \
+ "\tif(it == sTypeBlobMap.end())\n" \
+ "\t\treturn 0;\n" \
+ "\treturn it->second;\n" \
"}\n"
# combine all definition lists
stream = [
return src
incFileName = inc.string[inc.start(1):inc.end(1)]
patternIncNamed = r'#include\s+"' + incFileName + '"'
- incBody = readFile(os.path.join(dir, incFileName)) if incFileName != 'vulkan/vk_platform.h' else ''
+ incBody = readFile(os.path.join(dir, incFileName)) if incFileName != 'vk_platform.h' else ''
incBodySanitized = re.sub(pattern, '', incBody)
bodyEndSanitized = re.sub(patternIncNamed, '', src[inc.end(0):])
src = src[0:inc.start(0)] + incBodySanitized + bodyEndSanitized