("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"], "deUint32"),
- (["GgpFrameToken"], ["GgpFrameToken"], "deInt32"),
- (["GgpStreamDescriptor"], ["GgpStreamDescriptor"], "deInt32"),
+ (["zx_handle_t"], ["zx_handle_t"], "uint32_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("VIEWPORT_W", "VIEWPORT_W_")
name = name.replace("_IDPROPERTIES", "_ID_PROPERTIES")
name = name.replace("PHYSICAL_DEVICE_SHADER_FLOAT_16_INT_8_FEATURES", "PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES")
+ name = name.replace("PHYSICAL_DEVICE_RGBA_10_X_6_FORMATS_FEATURES_EXT", "PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT")
name = name.replace("_PCIBUS_", "_PCI_BUS_")
name = name.replace("ASTCD", "ASTC_D")
name = name.replace("AABBNV", "AABB_NV")
name = name.replace("_H_264_", "_H264_")
name = name.replace("_H_265_", "_H265_")
name = name.replace("RDMAFEATURES", "RDMA_FEATURES")
+ name = name.replace("RGBA_10_X_6", "RGBA10X6")
return prefix + name
return False
if definition[0].startswith(extNameUpper):
return True
- if definition[1].isdigit():
+ if definition[0].endswith("_H_"):
return True
return False
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)
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)
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]):
for line in genBitfield64Src(bitfield64):
yield line
- 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:
"StdVideoH265PpsFlags",
"StdVideoDecodeH265PictureInfoFlags",
"StdVideoDecodeH265ReferenceInfoFlags",
- "StdVideoEncodeH265PictureInfoFlags"
+ "StdVideoEncodeH265PictureInfoFlags",
+ "StdVideoEncodeH265SliceHeaderFlags",
+ "StdVideoEncodeH265ReferenceModificationFlags",
+ "StdVideoEncodeH265ReferenceInfoFlags",
])
COMPOSITE_TYPES = set([t.name for t in api.compositeTypes if not t.isAlias])
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 = []
sType = "ASTC_DECODE_MODE"
if sType in {'VULKAN_1_1', 'VULKAN_1_2'}:
continue
+ # skip cases that have const pNext pointer
+ if sType == 'RASTERIZATION_ORDER_ATTACHMENT_ACCESS':
+ continue
# end handling special cases
ptrnExtensionName = r'^\s*#define\s+(\w+' + sSuffix + '_' + sType + '_EXTENSION_NAME).+$'
matchExtensionName = re.search(ptrnExtensionName, src, re.M)
matchStructName = re.search(ptrnStructName, src, re.M)
if matchStructName:
extType = sType
- if extType == "MAINTENANCE_3":
- extType = "MAINTENANCE3"
- elif extType == "DISCARD_RECTANGLE":
+ if extType == "DISCARD_RECTANGLE":
extType = "DISCARD_RECTANGLES"
elif extType == "DRIVER":
extType = "DRIVER_PROPERTIES"
elif extType == "POINT_CLIPPING":
- extType = "MAINTENANCE2"
+ extType = "MAINTENANCE_2"
elif extType == "SHADER_CORE":
extType = "SHADER_CORE_PROPERTIES"
elif extType == "DRM":
stream.append('} // vk\n')
writeInlFile(filename, INL_HEADER, stream)
+def writeDeviceFeatureTest(api, filename):
+
+ coreFeaturesPattern = re.compile("^VkPhysicalDeviceVulkan([1-9][0-9])Features[0-9]*$")
+ featureItems = []
+ # iterate over all feature structures
+ allFeaturesPattern = re.compile("^VkPhysicalDevice\w+Features[1-9]*")
+ for structureType in api.compositeTypes:
+ # skip structures that are not feature structures
+ if not allFeaturesPattern.match(structureType.name):
+ continue
+ # skip alias structures
+ if structureType.isAlias:
+ continue
+ # skip sType and pNext and just grab third and next attributes
+ structureMembers = structureType.members[2:]
+
+ items = []
+ for member in structureMembers:
+ items.append(" FEATURE_ITEM ({0}, {1}),".format(structureType.name, member.name))
+
+ testBlock = \
+ "if (const void* featuresStruct = findStructureInChain(const_cast<const void*>(deviceFeatures2.pNext), getStructureType<{0}>()))\n" \
+ "{{\n" \
+ " static const Feature features[] =\n" \
+ " {{\n" \
+ "{1}\n" \
+ " }};\n" \
+ " auto* supportedFeatures = reinterpret_cast<const {0}*>(featuresStruct);\n" \
+ " checkFeatures(vkp, instance, instanceDriver, physicalDevice, {2}, features, supportedFeatures, queueFamilyIndex, queueCount, queuePriority, numErrors, resultCollector, {3}, emptyDeviceFeatures);\n" \
+ "}}\n"
+ featureItems.append(testBlock.format(structureType.name, "\n".join(items), len(items), ("DE_NULL" if coreFeaturesPattern.match(structureType.name) else "&extensionNames")))
+
+ stream = ['']
+ stream.extend(featureItems)
+ writeInlFile(filename, INL_HEADER, stream)
+
def writeDeviceProperties(api, dpDefs, filename):
# find VkPhysicalDeviceVulkan[1-9][0-9]Features blob structurs
# and construct dictionary with all of their attributes
writeDeviceFeaturesDefaultDeviceDefs (dfd, os.path.join(outputPath, "vkDeviceFeaturesForDefaultDeviceDefs.inl"))
writeDeviceFeaturesContextDecl (dfd, os.path.join(outputPath, "vkDeviceFeaturesForContextDecl.inl"))
writeDeviceFeaturesContextDefs (dfd, os.path.join(outputPath, "vkDeviceFeaturesForContextDefs.inl"))
+ writeDeviceFeatureTest (api, os.path.join(outputPath, "vkDeviceFeatureTest.inl"))
dpd = generateDevicePropertiesDefs(src)
writeDeviceProperties (api, dpd, os.path.join(outputPath, "vkDeviceProperties.inl"))