"vkGetPhysicalDeviceFeatures",
"vkGetPhysicalDeviceFormatProperties",
"vkGetPhysicalDeviceImageFormatProperties",
+ "vkGetPhysicalDeviceSparseImageFormatProperties",
"vkGetPhysicalDeviceLimits",
"vkGetPhysicalDeviceProperties",
"vkGetPhysicalDeviceQueueFamilyProperties",
"vkEnumerateDeviceLayerProperties",
"vkCreateDevice",
"vkGetDeviceProcAddr",
+
+ # VK_KHR_surface
+ "vkDestroySurfaceKHR",
+ "vkGetPhysicalDeviceSurfaceSupportKHR",
+ "vkGetPhysicalDeviceSurfaceCapabilitiesKHR",
+ "vkGetPhysicalDeviceSurfaceFormatsKHR",
+ "vkGetPhysicalDeviceSurfacePresentModesKHR",
+
+ # VK_KHR_display
+ "vkGetPhysicalDeviceDisplayPropertiesKHR",
+ "vkGetPhysicalDeviceDisplayPlanePropertiesKHR",
+ "vkGetDisplayPlaneSupportedDisplaysKHR",
+ "vkGetDisplayModePropertiesKHR",
+ "vkCreateDisplayModeKHR",
+ "vkGetDisplayPlaneCapabilitiesKHR",
+ "vkCreateDisplayPlaneSurfaceKHR",
+
+ # VK_KHR_xlib_surface
+ "vkCreateXlibSurfaceKHR",
+ "vkGetPhysicalDeviceXlibPresentationSupportKHR",
+
+ # VK_KHR_xcb_surface
+ "vkCreateXcbSurfaceKHR",
+ "vkGetPhysicalDeviceXcbPresentationSupportKHR",
+
+ # VK_KHR_wayland_surface
+ "vkCreateWaylandSurfaceKHR",
+ "vkGetPhysicalDeviceWaylandPresentationSupportKHR",
+
+ # VK_KHR_mir_surface
+ "vkCreateMirSurfaceKHR",
+ "vkGetPhysicalDeviceMirPresentationSupportKHR",
+
+ # VK_KHR_android_surface
+ "vkCreateAndroidSurfaceKHR",
+
+ # VK_KHR_win32_surface
+ "vkCreateWin32SurfaceKHR",
+ "vkGetPhysicalDeviceWin32PresentationSupportKHR",
+
+ # VK_EXT_debug_report
+ "vkCreateDebugReportCallbackEXT",
+ "vkDestroyDebugReportCallbackEXT",
+ "vkDebugReportMessageEXT",
]
DEFINITIONS = [
"VK_MAX_MEMORY_HEAPS",
"VK_MAX_DESCRIPTION_SIZE",
"VK_ATTACHMENT_UNUSED",
+ "VK_SUBPASS_EXTERNAL"
]
+PLATFORM_TYPES = [
+ # VK_KHR_xlib_surface
+ ("Display*", "XlibDisplayPtr", "void*"),
+ ("Window", "XlibWindow", "deUintptr",),
+ ("VisualID", "XlibVisualID", "deUint32"),
+
+ # VK_KHR_xcb_surface
+ ("xcb_connection_t*", "XcbConnectionPtr", "void*"),
+ ("xcb_window_t", "XcbWindow", "deUintptr"),
+ ("xcb_visualid_t", "XcbVisualid", "deUint32"),
+
+ # VK_KHR_wayland_surface
+ ("struct wl_display*", "WaylandDisplayPtr", "void*"),
+ ("struct wl_surface*", "WaylandSurfacePtr", "void*"),
+
+ # VK_KHR_mir_surface
+ ("MirConnection*", "MirConnectionPtr", "void*"),
+ ("MirSurface*", "MirSurfacePtr", "void*"),
+
+ # VK_KHR_android_surface
+ ("ANativeWindow*", "AndroidNativeWindowPtr", "void*"),
+
+ # VK_KHR_win32_surface
+ ("HINSTANCE", "Win32InstanceHandle", "void*"),
+ ("HWND", "Win32WindowHandle", "void*")
+]
+PLATFORM_TYPE_NAMESPACE = "pt"
+
class Handle:
TYPE_DISP = 0
TYPE_NONDISP = 1
return fixed
def fixupType (type):
+ for platformType, substitute, compat in PLATFORM_TYPES:
+ if type == platformType:
+ return PLATFORM_TYPE_NAMESPACE + "::" + substitute
+
replacements = [
("uint8_t", "deUint8"),
("uint16_t", "deUint16"),
assert function.name[:2] == "vk"
return function.name[2:] + "Func"
+def endsWith (str, postfix):
+ return str[-len(postfix):] == postfix
+
+def splitNameExtPostfix (name):
+ knownExtPostfixes = ["KHR", "EXT"]
+ for postfix in knownExtPostfixes:
+ if endsWith(name, postfix):
+ return (name[:-len(postfix)], postfix)
+ return (name, "")
+
def getBitEnumNameForBitfield (bitfieldName):
- if bitfieldName[-3:] == "KHR":
- postfix = "KHR"
- bitfieldName = bitfieldName[:-3]
- else:
- postfix = ""
+ bitfieldName, postfix = splitNameExtPostfix(bitfieldName)
assert bitfieldName[-1] == "s"
return bitfieldName[:-1] + "Bits" + postfix
def getBitfieldNameForBitEnum (bitEnumName):
- if bitEnumName[-3:] == "KHR":
- postfix = "KHR"
- bitEnumName = bitEnumName[:-3]
- else:
- postfix = ""
+ bitEnumName, postfix = splitNameExtPostfix(bitEnumName)
assert bitEnumName[-4:] == "Bits"
return bitEnumName[:-4] + "s" + postfix
types = []
for type, structname, contents, typename in matches:
- if typename[-3:] == "KHR":
- continue # \todo [2016-01-05 pyry] Figure out how to handle platform-specific types
-
types.append(parseCompositeType(typeMap[type], typename, contents))
return types
functions = []
for returnType, name, argList in matches:
- if name[-3:] == "KHR":
- continue # \todo [2015-11-16 pyry] Figure out how to handle platform-specific extension functions
-
functions.append(Function(name.strip(), returnType.strip(), parseArgList(argList)))
return [fixupFunction(f) for f in functions]
def getEnumValuePrefix (enum):
prefix = enum.name[0]
for i in range(1, len(enum.name)):
- if enum.name[i].isupper():
+ if enum.name[i].isupper() and not enum.name[i-1].isupper():
prefix += "_"
prefix += enum.name[i].upper()
return prefix
for line in genBitfieldSrc(bitfield):
yield line
yield ""
+ for line in indentLines(["VK_DEFINE_PLATFORM_TYPE(%s,\t%s);" % (s, c) for n, s, c in PLATFORM_TYPES]):
+ yield line
writeInlFile(filename, INL_HEADER, gen())
for line in indentLines(["template<> const char*\tgetTypeName<%s>\t(void) { return \"%s\";\t}" % (handle.name, handle.name) for handle in api.handles]):
yield line
+ yield ""
+ yield "namespace %s" % PLATFORM_TYPE_NAMESPACE
+ yield "{"
+
+ for line in indentLines("std::ostream& operator<< (std::ostream& s, %s\tv) { return s << tcu::toHex(v.internal); }" % s for n, s, c in PLATFORM_TYPES):
+ yield line
+
+ yield "}"
+
for enum in api.enums:
yield ""
yield "const char* get%sName (%s value)" % (enum.name[2:], enum.name)
newLine = "'\\n' << "
valFmt = "tcu::formatArray(tcu::Format::HexIterator<%s>(DE_ARRAY_BEGIN(value.%s)), tcu::Format::HexIterator<%s>(DE_ARRAY_END(value.%s)))" % (member.type, baseName, member.type, baseName)
else:
+ if baseName == "memoryTypes" or baseName == "memoryHeaps":
+ endIter = "DE_ARRAY_BEGIN(value.%s) + value.%sCount" % (baseName, baseName[:-1])
+ else:
+ endIter = "DE_ARRAY_END(value.%s)" % baseName
newLine = "'\\n' << "
- valFmt = "tcu::formatArray(DE_ARRAY_BEGIN(value.%s), DE_ARRAY_END(value.%s))" % (baseName, baseName)
+ valFmt = "tcu::formatArray(DE_ARRAY_BEGIN(value.%s), %s)" % (baseName, endIter)
memberName = baseName
else:
valFmt = "value.%s" % member.name
funcs = []
for function in api.functions:
if (function.name[:8] == "vkCreate" or function.name == "vkAllocateMemory") and not "count" in [a.name for a in function.arguments]:
+ if function.name == "vkCreateDisplayModeKHR":
+ continue # No way to delete display modes (bug?)
+
# \todo [pyry] Rather hacky
iface = None
if function.getType() == Function.TYPE_PLATFORM:
yield ""
for function in functions:
- dtorObj = "device" if function.type == Function.TYPE_DEVICE else "object"
+ if function.type == Function.TYPE_DEVICE:
+ dtorObj = "device"
+ elif function.type == Function.TYPE_INSTANCE:
+ if function.name == "createDevice":
+ dtorObj = "object"
+ else:
+ dtorObj = "instance"
+ else:
+ dtorObj = "object"
yield "Move<%s> %s (%s)" % (function.objectType, function.name, argListToStr([function.iface] + function.arguments))
yield "{"
"vkFreeDescriptorSets",
"vkResetDescriptorPool",
"vkAllocateCommandBuffers",
- "vkFreeCommandBuffers"
+ "vkFreeCommandBuffers",
+ "vkCreateDisplayModeKHR",
+ "vkCreateSharedSwapchainsKHR",
]
specialFuncs = [f for f in api.functions if f.name in specialFuncNames]
createFuncs = [f for f in api.functions if (f.name[:8] == "vkCreate" or f.name == "vkAllocateMemory") and not f in specialFuncs]