X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=external%2Fvulkancts%2Fgen_framework.py;h=e6d9e554feaf550bb30cdd135162a708376e5649;hb=71a9bc447deafbf9d091a87530b320db7c2cdb9c;hp=0c53b71cf4563f11c5baa7990745d348480dde41;hpb=a816f7fbf0fa53e86773cb4d248c16b1644ea3dc;p=platform%2Fupstream%2FVK-GL-CTS.git diff --git a/external/vulkancts/gen_framework.py b/external/vulkancts/gen_framework.py index 0c53b71..e6d9e55 100644 --- a/external/vulkancts/gen_framework.py +++ b/external/vulkancts/gen_framework.py @@ -6,24 +6,17 @@ # # Copyright (c) 2015 Google Inc. # -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and/or associated documentation files (the -# "Materials"), to deal in the Materials without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Materials, and to -# permit persons to whom the Materials are furnished to do so, subject to -# the following conditions: +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# The above copyright notice(s) and this permission notice shall be -# included in all copies or substantial portions of the Materials. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # #------------------------------------------------------------------------- @@ -56,6 +49,7 @@ INSTANCE_FUNCTIONS = [ "vkGetPhysicalDeviceFeatures", "vkGetPhysicalDeviceFormatProperties", "vkGetPhysicalDeviceImageFormatProperties", + "vkGetPhysicalDeviceSparseImageFormatProperties", "vkGetPhysicalDeviceLimits", "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceQueueFamilyProperties", @@ -64,6 +58,50 @@ INSTANCE_FUNCTIONS = [ "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 = [ @@ -75,8 +113,37 @@ 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 @@ -164,6 +231,10 @@ def fixupEnumValues (values): 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"), @@ -196,22 +267,24 @@ def getFunctionTypeName (function): 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 @@ -257,9 +330,6 @@ def parseCompositeTypes (src): 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 @@ -291,9 +361,6 @@ def parseFunctions (src): 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] @@ -347,7 +414,7 @@ def writeHandleType (api, filename): 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 @@ -423,6 +490,8 @@ def writeBasicTypes (api, filename): 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()) @@ -501,6 +570,15 @@ def writeStrUtilImpl (api, filename): 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) @@ -552,8 +630,12 @@ def writeStrUtilImpl (api, filename): 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 @@ -577,6 +659,9 @@ def getConstructorFunctions (api): 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: @@ -627,7 +712,15 @@ def writeRefUtilImpl (api, filename): 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 "{" @@ -658,7 +751,9 @@ def writeNullDriverImpl (api, filename): "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]