X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=external%2Fvulkancts%2Fscripts%2Fgen_framework.py;h=dd58026a1426d2fd2a5c9da5ccc004050b1279e3;hb=7973a5fb4e9b66a01aa6e791f2bffe5e63888119;hp=32968571c63fffdc42027d8b34840174c048e794;hpb=896b19b00708631902a0c710b3add254102d26aa;p=platform%2Fupstream%2FVK-GL-CTS.git diff --git a/external/vulkancts/scripts/gen_framework.py b/external/vulkancts/scripts/gen_framework.py index 3296857..dd58026 100755 --- a/external/vulkancts/scripts/gen_framework.py +++ b/external/vulkancts/scripts/gen_framework.py @@ -52,12 +52,12 @@ DEFINITIONS = [ ("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"), @@ -66,13 +66,13 @@ DEFINITIONS = [ 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*"), @@ -97,28 +97,17 @@ PLATFORM_TYPES = [ # 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*"), ] @@ -153,6 +142,8 @@ def prefixName (prefix, name): 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_") @@ -696,7 +687,7 @@ def parseExtensions (src, versions, allFunctions, allCompositeTypes, allEnums, a 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) @@ -704,7 +695,7 @@ def parseExtensions (src, versions, allFunctions, allCompositeTypes, allEnums, a 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] @@ -726,7 +717,7 @@ def parseExtensions (src, versions, allFunctions, allCompositeTypes, allEnums, a 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) @@ -751,12 +742,12 @@ def parse64bitBitfieldValues (src, bitfieldNamesList): 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) @@ -782,6 +773,7 @@ def parseAPI (src): populateAliasesWithTypedefs(compositeTypes, src) populateAliasesWithTypedefs(enums, src) populateAliasesWithTypedefs(bitfields, src) + populateAliasesWithTypedefs(bitfields64, src) populateAliasesWithTypedefs(handles, src) for enum in enums: @@ -873,16 +865,23 @@ def genEnumSrc (enum): 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 @@ -896,10 +895,10 @@ def genBitfieldSrc (bitfield): 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]): @@ -996,11 +995,17 @@ def writeBasicTypes (api, filename): 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: @@ -1188,7 +1193,7 @@ def writeStrUtilImpl (api, filename): 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: @@ -1528,7 +1533,7 @@ def writeDriverIds(filename): driverIdsString.append("static const struct\n" "{\n" "\tstd::string driver;\n" - "\tdeUint32 id;\n" + "\tuint32_t id;\n" "} driverIds [] =\n" "{") @@ -1589,11 +1594,11 @@ def writeSupportedExtenions(api, filename): lines = addVersionDefines(versionSet) + [ "", - "void getCoreDeviceExtensionsImpl (deUint32 coreVersion, ::std::vector&%s)" % (" dst" if len(deviceMap) != 0 else ""), + "void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector&%s)" % (" dst" if len(deviceMap) != 0 else ""), "{"] + writeExtensionsForVersions(deviceMap) + [ "}", "", - "void getCoreInstanceExtensionsImpl (deUint32 coreVersion, ::std::vector&%s)" % (" dst" if len(instanceMap) != 0 else ""), + "void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector&%s)" % (" dst" if len(instanceMap) != 0 else ""), "{"] + writeExtensionsForVersions(instanceMap) + [ "}", ""] + removeVersionDefines(versionSet) @@ -1642,10 +1647,10 @@ def writeExtensionFunctions (api, filename): 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& functions)\n{' + yield 'void getInstanceExtensionFunctions (uint32_t apiVersion, ::std::string extName, ::std::vector& functions)\n{' dg_list = ["vkGetPhysicalDevicePresentRectanglesKHR"] elif functionType == Function.TYPE_DEVICE: - yield 'void getDeviceExtensionFunctions (deUint32 apiVersion, ::std::string extName, ::std::vector& functions)\n{' + yield 'void getDeviceExtensionFunctions (uint32_t apiVersion, ::std::string extName, ::std::vector& functions)\n{' dg_list = ["vkGetDeviceGroupPresentCapabilitiesKHR", "vkGetDeviceGroupSurfacePresentModesKHR", "vkAcquireNextImage2KHR"] for ext in api.extensions: funcNames = [] @@ -1700,12 +1705,12 @@ def writeCoreFunctionalities(api, filename): "", "typedef ::std::pair FunctionInfo;", "typedef ::std::vector FunctionInfosList;", - "typedef ::std::map ApisMap;", + "typedef ::std::map ApisMap;", "", "void initApisMap (ApisMap& apis)", "{", " apis.clear();"] + [ - " apis.insert(::std::pair(" + str(v) + ", FunctionInfosList()));" for v in api.versions] + [ + " apis.insert(::std::pair(" + str(v) + ", FunctionInfosList()));" for v in api.versions] + [ ""] apiVersions = [] @@ -1727,25 +1732,81 @@ def writeDeviceFeatures2(api, filename): # 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): @@ -1756,12 +1817,23 @@ def writeDeviceFeatures2(api, filename): # 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)) @@ -1820,7 +1892,7 @@ def writeDeviceFeatures2(api, filename): 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 = '' @@ -1830,15 +1902,15 @@ def writeDeviceFeatures2(api, filename): 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'; @@ -1891,7 +1963,11 @@ def generateDeviceFeaturesDefs(src): 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).+$' @@ -1913,7 +1989,7 @@ def generateDevicePropertiesDefs(src): 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 @@ -1934,6 +2010,8 @@ def generateDevicePropertiesDefs(src): extType = sType if extType == "MAINTENANCE_3": extType = "MAINTENANCE3" + elif extType == "MAINTENANCE_4": + extType = "MAINTENANCE4" elif extType == "DISCARD_RECTANGLE": extType = "DISCARD_RECTANGLES" elif extType == "DRIVER": @@ -2029,6 +2107,10 @@ def writeDeviceFeatures(api, dfDefs, filename): 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) @@ -2036,9 +2118,9 @@ def writeDeviceFeatures(api, dfDefs, filename): "{{ 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 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 sTypeBlobMap\n" \ "\t{\n" # iterate over blobs with list of structures for blobName in sorted(blobStructs.keys()): @@ -2059,11 +2141,17 @@ def writeDeviceFeatures(api, dfDefs, filename): # 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 = [ @@ -2077,7 +2165,7 @@ def writeDeviceFeatures(api, dfDefs, filename): 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) @@ -2168,9 +2256,9 @@ def writeDeviceProperties(api, dpDefs, filename): "{{ 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 sTypeVect =" \ + # construct method that will check if structure sType is part of blob + blobChecker = "deUint32 getBlobPropertiesVersion (VkStructureType sType)\n{\n" \ + "\tconst std::map sTypeBlobMap\n" \ "\t{\n" # iterate over blobs with list of structures for blobName in sorted(blobStructs.keys()): @@ -2185,9 +2273,13 @@ def writeDeviceProperties(api, dpDefs, filename): 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 = [ @@ -2378,7 +2470,7 @@ def preprocessTopInclude(src, dir): 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