Fix API version for functions in CoreFunctionalities
authorAlexander Galazin <alexander.galazin@arm.com>
Fri, 6 Oct 2017 21:19:41 +0000 (23:19 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 6 Oct 2017 22:34:06 +0000 (18:34 -0400)
Originally gen_framework.py deduced API version for a function
based on extension aliasing information. But this can be done
directly using VK_VERSION_1_0, VK_VERSION_1_1 placement.

Components: Vulkan

VK_GL_CTS Issue: 754

Affects: dEQP-VK.api.version_check.entry_points

Change-Id: I2432076fdad1b290ed123792138c4c364e5def5b

external/vulkancts/framework/vulkan/vkCoreFunctionalities.inl
external/vulkancts/scripts/gen_framework.py
external/vulkancts/scripts/src/vulkan.h.in

index 78cff1c51c238fc75f4772d4f73179db8c173665..db8d16e9d3b3a0cbc67b82e7c9c7ad9c72234045 100644 (file)
@@ -156,8 +156,6 @@ void initApisMap (ApisMap& apis)
        apis[VK_API_VERSION_1_0].push_back(FunctionInfo("vkCmdNextSubpass",                                                                     FUNCTIONORIGIN_DEVICE));
        apis[VK_API_VERSION_1_0].push_back(FunctionInfo("vkCmdEndRenderPass",                                                           FUNCTIONORIGIN_DEVICE));
        apis[VK_API_VERSION_1_0].push_back(FunctionInfo("vkCmdExecuteCommands",                                                         FUNCTIONORIGIN_DEVICE));
-       apis[VK_API_VERSION_1_0].push_back(FunctionInfo("vkEnumerateInstanceVersion",                                           FUNCTIONORIGIN_PLATFORM));
-       apis[VK_API_VERSION_1_0].push_back(FunctionInfo("vkGetDeviceQueue2",                                                            FUNCTIONORIGIN_DEVICE));
 
        apis[VK_API_VERSION_1_1].push_back(FunctionInfo("vkCreateInstance",                                                                     FUNCTIONORIGIN_PLATFORM));
        apis[VK_API_VERSION_1_1].push_back(FunctionInfo("vkDestroyInstance",                                                            FUNCTIONORIGIN_INSTANCE));
index 3f8a923ef467af526539c9de49c0b43f1d3dd76d..c0d4cbdcd248cd1a89a0563e3dae524d0fd74365 100644 (file)
@@ -326,12 +326,13 @@ class Function:
        TYPE_INSTANCE           = 1 # Bound to VkInstance
        TYPE_DEVICE                     = 2 # Bound to VkDevice
 
-       def __init__ (self, name, returnType, arguments):
+       def __init__ (self, name, returnType, arguments, apiVersion = None):
                self.name               = name
                self.returnType = returnType
                self.arguments  = arguments
                self.alias              = None
                self.isAlias    = False
+               self.apiVersion = apiVersion
 
        def getType (self):
                # Special functions
@@ -551,6 +552,22 @@ def parseFunctions (src):
                functions.append(Function(name.strip(), returnType.strip(), parseArgList(argList)))
        return functions
 
+def parseFunctionsByVersion (src):
+       ptrnVer10       = 'VK_VERSION_1_0 1'
+       ptrnVer11       = 'VK_VERSION_1_1 1'
+       matchVer10      = re.search(ptrnVer10, src)
+       matchVer11      = re.search(ptrnVer11, src)
+       ptrn            = r'VKAPI_ATTR\s+(' + TYPE_PTRN + ')\s+VKAPI_CALL\s+(' + IDENT_PTRN + r')\s*\(([^)]*)\)\s*;'
+       regPtrn         = re.compile(ptrn)
+       matches         = regPtrn.findall(src, matchVer10.start(), matchVer11.start())
+       functions       = []
+       for returnType, name, argList in matches:
+               functions.append(Function(name.strip(), returnType.strip(), parseArgList(argList), 'VK_VERSION_1_0'))
+       matches         = regPtrn.findall(src, matchVer11.start())
+       for returnType, name, argList in matches:
+               functions.append(Function(name.strip(), returnType.strip(), parseArgList(argList), 'VK_VERSION_1_1'))
+       return functions
+
 def splitByExtension (src):
        ptrn            = r'#define\s+[A-Z0-9_]+_EXTENSION_NAME\s+"([^"]+)"'
        match           = "#define\s+("
@@ -638,7 +655,7 @@ def parseAPI (src):
        bitfields               = []
        bitfieldEnums   = set([getBitEnumNameForBitfield(n) for n in bitfieldNames if getBitEnumNameForBitfield(n) in [enum.name for enum in rawEnums]])
        compositeTypes  = parseCompositeTypes(src)
-       allFunctions    = parseFunctions(src)
+       allFunctions    = parseFunctionsByVersion(src)
 
        for enum in rawEnums:
                if enum.name in bitfieldEnums:
@@ -1325,9 +1342,9 @@ def writeCoreFunctionalities(api, filename):
        "       apis.insert(::std::pair<deUint32, FunctionInfosList>(" + str(Version((1, 1, 0))) + ", FunctionInfosList()));",
        ""]
 
-       def listUpgradedFuncs ():
-               for fun in api.extensions[0].functions:
-                       if not fun.isAlias and fun.alias == None:
+       def list10Funcs ():
+               for fun in api.functions:
+                       if fun.apiVersion == 'VK_VERSION_1_0':
                                insert = '      apis[' + str(Version((1, 0, 0))) + '].push_back(FunctionInfo("' + fun.name + '",\t' + functionOriginValues[fun.getType()] + '));'
                                yield insert
 
@@ -1336,7 +1353,7 @@ def writeCoreFunctionalities(api, filename):
                        insert = '      apis[' + str(Version((1, 1, 0))) + '].push_back(FunctionInfo("' + fun.name + '",\t' + functionOriginValues[fun.getType()] + '));'
                        yield insert
 
-       lines = lines + [line for line in indentLines(listUpgradedFuncs())]
+       lines = lines + [line for line in indentLines(list10Funcs())]
        lines.append("")
        lines = lines + [line for line in indentLines(listAllFuncs())]
 
index 1f7fb37fbd88fc567b82dafdc63a2fd180d07d1a..531b3747b290b5988e06fc0383c23acc1153cfe8 100644 (file)
@@ -38,7 +38,6 @@ extern "C" {
 
 // Vulkan 1.0 version number
 #define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)
-#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)
 
 #define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
 #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
@@ -3516,7 +3515,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(
 
 #define VK_VERSION_1_1 1
 // Vulkan 1.1 version number
-#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)// Patch version should always be set to 0
+#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)
 
 
 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion)