Fix for getPhysicalDeviceFeatures2 loader issue
authorMarcin Rogucki <marcin.rogucki@mobica.com>
Mon, 20 Nov 2017 15:44:51 +0000 (16:44 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 14 Dec 2017 09:35:56 +0000 (04:35 -0500)
For all instance methods taking VkPhysicalDevice
as a first parameter that were moved to core in
1.1 there is now a dynamic dispatch based on
physical device api version. If version is 1.1 or
above a core method is used. If version is lower
than that a counterpart extension method is used.

Additionally a pre-instance is created to enumerate
all physical devices and select lowest version to
be able to enable proper extensions set for final
instance.

Components: Vulkan

VK-GL-CTS issue: 854

Affects: All tests using getPhysicalDeviceFeatures2

Change-Id: Ia68a5cac23ae35566fcf99bc56c93c9cb77f33e0

external/vulkancts/framework/vulkan/vkInitInstanceFunctionPointers.inl
external/vulkancts/framework/vulkan/vkInstanceDriverImpl.inl
external/vulkancts/framework/vulkan/vkInstanceFunctionPointers.inl
external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp
external/vulkancts/modules/vulkan/vktTestCase.cpp
external/vulkancts/modules/vulkan/vktTestCase.hpp
external/vulkancts/scripts/gen_framework.py

index 6c7e5cf..6ca622e 100644 (file)
@@ -71,6 +71,16 @@ m_vk.getPhysicalDeviceMirPresentationSupportKHR                              = (GetPhysicalDeviceMirPresen
 m_vk.createAndroidSurfaceKHR                                                           = (CreateAndroidSurfaceKHRFunc)                                                         GET_PROC_ADDR("vkCreateAndroidSurfaceKHR");
 m_vk.createWin32SurfaceKHR                                                                     = (CreateWin32SurfaceKHRFunc)                                                           GET_PROC_ADDR("vkCreateWin32SurfaceKHR");
 m_vk.getPhysicalDeviceWin32PresentationSupportKHR                      = (GetPhysicalDeviceWin32PresentationSupportKHRFunc)            GET_PROC_ADDR("vkGetPhysicalDeviceWin32PresentationSupportKHR");
+m_vk.getPhysicalDeviceFeatures2KHR                                                     = (GetPhysicalDeviceFeatures2KHRFunc)                                           GET_PROC_ADDR("vkGetPhysicalDeviceFeatures2KHR");
+m_vk.getPhysicalDeviceFormatProperties2KHR                                     = (GetPhysicalDeviceFormatProperties2KHRFunc)                           GET_PROC_ADDR("vkGetPhysicalDeviceFormatProperties2KHR");
+m_vk.getPhysicalDeviceImageFormatProperties2KHR                                = (GetPhysicalDeviceImageFormatProperties2KHRFunc)                      GET_PROC_ADDR("vkGetPhysicalDeviceImageFormatProperties2KHR");
+m_vk.getPhysicalDeviceMemoryProperties2KHR                                     = (GetPhysicalDeviceMemoryProperties2KHRFunc)                           GET_PROC_ADDR("vkGetPhysicalDeviceMemoryProperties2KHR");
+m_vk.getPhysicalDeviceProperties2KHR                                           = (GetPhysicalDeviceProperties2KHRFunc)                                         GET_PROC_ADDR("vkGetPhysicalDeviceProperties2KHR");
+m_vk.getPhysicalDeviceQueueFamilyProperties2KHR                                = (GetPhysicalDeviceQueueFamilyProperties2KHRFunc)                      GET_PROC_ADDR("vkGetPhysicalDeviceQueueFamilyProperties2KHR");
+m_vk.getPhysicalDeviceSparseImageFormatProperties2KHR          = (GetPhysicalDeviceSparseImageFormatProperties2KHRFunc)        GET_PROC_ADDR("vkGetPhysicalDeviceSparseImageFormatProperties2KHR");
+m_vk.getPhysicalDeviceExternalBufferPropertiesKHR                      = (GetPhysicalDeviceExternalBufferPropertiesKHRFunc)            GET_PROC_ADDR("vkGetPhysicalDeviceExternalBufferPropertiesKHR");
+m_vk.getPhysicalDeviceExternalSemaphorePropertiesKHR           = (GetPhysicalDeviceExternalSemaphorePropertiesKHRFunc)         GET_PROC_ADDR("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR");
+m_vk.getPhysicalDeviceExternalFencePropertiesKHR                       = (GetPhysicalDeviceExternalFencePropertiesKHRFunc)                     GET_PROC_ADDR("vkGetPhysicalDeviceExternalFencePropertiesKHR");
 m_vk.getPhysicalDeviceSurfaceCapabilities2KHR                          = (GetPhysicalDeviceSurfaceCapabilities2KHRFunc)                        GET_PROC_ADDR("vkGetPhysicalDeviceSurfaceCapabilities2KHR");
 m_vk.getPhysicalDeviceSurfaceFormats2KHR                                       = (GetPhysicalDeviceSurfaceFormats2KHRFunc)                                     GET_PROC_ADDR("vkGetPhysicalDeviceSurfaceFormats2KHR");
 m_vk.createDebugReportCallbackEXT                                                      = (CreateDebugReportCallbackEXTFunc)                                            GET_PROC_ADDR("vkCreateDebugReportCallbackEXT");
index 74e0252..8d80744 100644 (file)
@@ -74,52 +74,102 @@ VkResult InstanceDriver::enumeratePhysicalDeviceGroups (VkInstance instance, deU
 
 void InstanceDriver::getPhysicalDeviceFeatures2 (VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) const
 {
-       m_vk.getPhysicalDeviceFeatures2(physicalDevice, pFeatures);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceFeatures2(physicalDevice, pFeatures);
+       else
+               m_vk.getPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures);
 }
 
 void InstanceDriver::getPhysicalDeviceProperties2 (VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties) const
 {
-       m_vk.getPhysicalDeviceProperties2(physicalDevice, pProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceProperties2(physicalDevice, pProperties);
+       else
+               m_vk.getPhysicalDeviceProperties2KHR(physicalDevice, pProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceFormatProperties2 (VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) const
 {
-       m_vk.getPhysicalDeviceFormatProperties2(physicalDevice, format, pFormatProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceFormatProperties2(physicalDevice, format, pFormatProperties);
+       else
+               m_vk.getPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties);
 }
 
 VkResult InstanceDriver::getPhysicalDeviceImageFormatProperties2 (VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) const
 {
-       return m_vk.getPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               return m_vk.getPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties);
+       else
+               return m_vk.getPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, pImageFormatProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceQueueFamilyProperties2 (VkPhysicalDevice physicalDevice, deUint32* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) const
 {
-       m_vk.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
+       else
+               m_vk.getPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceMemoryProperties2 (VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties) const
 {
-       m_vk.getPhysicalDeviceMemoryProperties2(physicalDevice, pMemoryProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceMemoryProperties2(physicalDevice, pMemoryProperties);
+       else
+               m_vk.getPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceSparseImageFormatProperties2 (VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, deUint32* pPropertyCount, VkSparseImageFormatProperties2* pProperties) const
 {
-       m_vk.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties);
+       else
+               m_vk.getPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceExternalBufferProperties (VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) const
 {
-       m_vk.getPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
+       else
+               m_vk.getPhysicalDeviceExternalBufferPropertiesKHR(physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceExternalFenceProperties (VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) const
 {
-       m_vk.getPhysicalDeviceExternalFenceProperties(physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceExternalFenceProperties(physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
+       else
+               m_vk.getPhysicalDeviceExternalFencePropertiesKHR(physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
 }
 
 void InstanceDriver::getPhysicalDeviceExternalSemaphoreProperties (VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) const
 {
-       m_vk.getPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
+       vk::VkPhysicalDeviceProperties props;
+       m_vk.getPhysicalDeviceProperties(physicalDevice, &props);
+       if (props.apiVersion >= VK_API_VERSION_1_1)
+               m_vk.getPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
+       else
+               m_vk.getPhysicalDeviceExternalSemaphorePropertiesKHR(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
 }
 
 void InstanceDriver::destroySurfaceKHR (VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) const
index 3a12891..1424886 100644 (file)
@@ -49,6 +49,16 @@ GetPhysicalDeviceMirPresentationSupportKHRFunc                       getPhysicalDeviceMirPresentatio
 CreateAndroidSurfaceKHRFunc                                                            createAndroidSurfaceKHR;
 CreateWin32SurfaceKHRFunc                                                              createWin32SurfaceKHR;
 GetPhysicalDeviceWin32PresentationSupportKHRFunc               getPhysicalDeviceWin32PresentationSupportKHR;
+GetPhysicalDeviceFeatures2KHRFunc                                              getPhysicalDeviceFeatures2KHR;
+GetPhysicalDeviceFormatProperties2KHRFunc                              getPhysicalDeviceFormatProperties2KHR;
+GetPhysicalDeviceImageFormatProperties2KHRFunc                 getPhysicalDeviceImageFormatProperties2KHR;
+GetPhysicalDeviceMemoryProperties2KHRFunc                              getPhysicalDeviceMemoryProperties2KHR;
+GetPhysicalDeviceProperties2KHRFunc                                            getPhysicalDeviceProperties2KHR;
+GetPhysicalDeviceQueueFamilyProperties2KHRFunc                 getPhysicalDeviceQueueFamilyProperties2KHR;
+GetPhysicalDeviceSparseImageFormatProperties2KHRFunc   getPhysicalDeviceSparseImageFormatProperties2KHR;
+GetPhysicalDeviceExternalBufferPropertiesKHRFunc               getPhysicalDeviceExternalBufferPropertiesKHR;
+GetPhysicalDeviceExternalSemaphorePropertiesKHRFunc            getPhysicalDeviceExternalSemaphorePropertiesKHR;
+GetPhysicalDeviceExternalFencePropertiesKHRFunc                        getPhysicalDeviceExternalFencePropertiesKHR;
 GetPhysicalDeviceSurfaceCapabilities2KHRFunc                   getPhysicalDeviceSurfaceCapabilities2KHR;
 GetPhysicalDeviceSurfaceFormats2KHRFunc                                        getPhysicalDeviceSurfaceFormats2KHR;
 CreateDebugReportCallbackEXTFunc                                               createDebugReportCallbackEXT;
index a1c7e1a..f9701ba 100644 (file)
@@ -66,11 +66,11 @@ public:
        virtual tcu::TestStatus         iterate                                 (void)
        {
                tcu::TestLog&                   log                             = m_context.getTestContext().getLog();
-               const vk::ApiVersion    instanceVersion = vk::unpackVersion(m_context.getInstanceVersion());
+               const vk::ApiVersion    instanceVersion = vk::unpackVersion(m_context.getAvailableInstanceVersion());
                const vk::ApiVersion    deviceVersion   = vk::unpackVersion(m_context.getDeviceVersion());
                const vk::ApiVersion    usedApiVersion  = vk::unpackVersion(m_context.getUsedApiVersion());
 
-               log << tcu::TestLog::Message << "instanceVersion: " << instanceVersion << tcu::TestLog::EndMessage;
+               log << tcu::TestLog::Message << "availableInstanceVersion: " << instanceVersion << tcu::TestLog::EndMessage;
                log << tcu::TestLog::Message << "deviceVersion: " << deviceVersion << tcu::TestLog::EndMessage;
                log << tcu::TestLog::Message << "usedApiVersion: " << usedApiVersion << tcu::TestLog::EndMessage;
                const ::std::string             result                  = de::toString(usedApiVersion.majorNum) + ::std::string(".") + de::toString(usedApiVersion.minorNum) + ::std::string(".") + de::toString(usedApiVersion.patchNum);
index 3f4103f..cc1bc71 100644 (file)
@@ -163,16 +163,38 @@ deUint32 getTargetInstanceVersion (const PlatformInterface& vkp)
        return version;
 }
 
+std::pair<deUint32, deUint32> determineDeviceVersions(const PlatformInterface& vkp, deUint32 apiVersion, const tcu::CommandLine& cmdLine)
+{
+       Move<VkInstance>                                                preinstance                             = createDefaultInstance(vkp, apiVersion);
+       InstanceDriver                                                  preinterface                    (vkp, preinstance.get());
+
+       const vector<VkPhysicalDevice>                  devices                                 = enumeratePhysicalDevices(preinterface, preinstance.get());
+       deUint32                                                                lowestDeviceVersion             = 0xFFFFFFFFu;
+       for (deUint32 deviceNdx = 0u; deviceNdx < devices.size(); ++deviceNdx)
+       {
+               const VkPhysicalDeviceProperties        props                                   = getPhysicalDeviceProperties(preinterface, devices[deviceNdx]);
+               if (props.apiVersion < lowestDeviceVersion)
+                       lowestDeviceVersion = props.apiVersion;
+       }
+
+       const vk::VkPhysicalDevice                              choosenDevice                   = chooseDevice(preinterface, *preinstance, cmdLine);
+       const VkPhysicalDeviceProperties                props                                   = getPhysicalDeviceProperties(preinterface, choosenDevice);
+       const deUint32                                                  choosenDeviceVersion    = props.apiVersion;
+
+       return std::make_pair(choosenDeviceVersion, lowestDeviceVersion);
+}
+
+
 Move<VkInstance> createInstance (const PlatformInterface& vkp, deUint32 apiVersion, const vector<string>& enabledExtensions, const tcu::CommandLine& cmdLine)
 {
-       const bool              isValidationEnabled     = cmdLine.isValidationEnabled();
-       vector<string>  enabledLayers;
+       const bool                                                              isValidationEnabled     = cmdLine.isValidationEnabled();
+       vector<string>                                                  enabledLayers;
 
        // \note Extensions in core are not explicitly enabled even though
        //               they are in the extension list advertised to tests.
-       vector<const char*> coreExtensions;
+       vector<const char*>                                             coreExtensions;
        getCoreInstanceExtensions(apiVersion, coreExtensions);
-       vector<string>  nonCoreExtensions       (removeExtensions(enabledExtensions, coreExtensions));
+       vector<string>                                                  nonCoreExtensions       (removeExtensions(enabledExtensions, coreExtensions));
 
        if (isValidationEnabled)
        {
@@ -311,7 +333,7 @@ public:
 
        VkInstance                                                                                              getInstance                                                     (void) const    { return *m_instance;                                                                           }
        const InstanceInterface&                                                                getInstanceInterface                            (void) const    { return m_instanceInterface;                                                           }
-       deUint32                                                                                                getInstanceVersion                                      (void) const    { return m_instanceVersion;                                                                     }
+       deUint32                                                                                                getAvailableInstanceVersion                     (void) const    { return m_availableInstanceVersion;                                            }
        const vector<string>&                                                                   getInstanceExtensions                           (void) const    { return m_instanceExtensions;                                                          }
 
        VkPhysicalDevice                                                                                getPhysicalDevice                                       (void) const    { return m_physicalDevice;                                                                      }
@@ -331,15 +353,17 @@ public:
 
 private:
 
-       const deUint32                                          m_instanceVersion;
+       const deUint32                                          m_availableInstanceVersion;
+
+       const std::pair<deUint32, deUint32> m_deviceVersions;
+       const deUint32                                          m_usedApiVersion;
+
        const vector<string>                            m_instanceExtensions;
        const Unique<VkInstance>                        m_instance;
        const InstanceDriver                            m_instanceInterface;
 
        const VkPhysicalDevice                          m_physicalDevice;
-
        const deUint32                                          m_deviceVersion;
-       const deUint32                                          m_usedApiVersion;
 
        const deUint32                                          m_universalQueueFamilyIndex;
        const VkPhysicalDeviceProperties        m_deviceProperties;
@@ -353,13 +377,17 @@ private:
 };
 
 DefaultDevice::DefaultDevice (const PlatformInterface& vkPlatform, const tcu::CommandLine& cmdLine)
-       : m_instanceVersion                             (getTargetInstanceVersion(vkPlatform))
-       , m_instanceExtensions                  (addCoreInstanceExtensions(filterExtensions(enumerateInstanceExtensionProperties(vkPlatform, DE_NULL)), m_instanceVersion))
-       , m_instance                                    (createInstance(vkPlatform, m_instanceVersion, m_instanceExtensions, cmdLine))
+       : m_availableInstanceVersion    (getTargetInstanceVersion(vkPlatform))
+       , m_deviceVersions                              (determineDeviceVersions(vkPlatform, m_availableInstanceVersion, cmdLine))
+       , m_usedApiVersion                              (deMinu32(m_availableInstanceVersion, m_deviceVersions.first))
+
+       , m_instanceExtensions                  (addCoreInstanceExtensions(filterExtensions(enumerateInstanceExtensionProperties(vkPlatform, DE_NULL)), m_usedApiVersion))
+       , m_instance                                    (createInstance(vkPlatform, m_usedApiVersion, m_instanceExtensions, cmdLine))
+
        , m_instanceInterface                   (vkPlatform, *m_instance)
        , m_physicalDevice                              (chooseDevice(m_instanceInterface, *m_instance, cmdLine))
        , m_deviceVersion                               (getPhysicalDeviceProperties(m_instanceInterface, m_physicalDevice).apiVersion)
-       , m_usedApiVersion                              (deMin32(m_instanceVersion, m_deviceVersion))
+
        , m_universalQueueFamilyIndex   (findQueueFamilyIndexWithCaps(m_instanceInterface, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT))
        , m_deviceProperties                    (getPhysicalDeviceProperties(m_instanceInterface, m_physicalDevice))
        , m_deviceExtensions                    (addCoreDeviceExtensions(filterExtensions(enumerateDeviceExtensionProperties(m_instanceInterface, m_physicalDevice, DE_NULL)), m_usedApiVersion))
@@ -367,6 +395,7 @@ DefaultDevice::DefaultDevice (const PlatformInterface& vkPlatform, const tcu::Co
        , m_device                                              (createDefaultDevice(m_instanceInterface, m_physicalDevice, m_usedApiVersion, m_universalQueueFamilyIndex, m_deviceFeatures.coreFeatures, m_deviceExtensions, cmdLine))
        , m_deviceInterface                             (m_instanceInterface, *m_device)
 {
+       DE_ASSERT(m_deviceVersions.first == m_deviceVersion);
 }
 
 DefaultDevice::~DefaultDevice (void)
@@ -405,7 +434,7 @@ Context::~Context (void)
 {
 }
 
-deUint32                                                               Context::getInstanceVersion                             (void) const { return m_device->getInstanceVersion();                   }
+deUint32                                                               Context::getAvailableInstanceVersion    (void) const { return m_device->getAvailableInstanceVersion();  }
 const vector<string>&                                  Context::getInstanceExtensions                  (void) const { return m_device->getInstanceExtensions();                }
 vk::VkInstance                                                 Context::getInstance                                    (void) const { return m_device->getInstance();                                  }
 const vk::InstanceInterface&                   Context::getInstanceInterface                   (void) const { return m_device->getInstanceInterface();                 }
index ce02791..66d1708 100644 (file)
@@ -60,7 +60,7 @@ public:
        vk::BinaryCollection&                                           getBinaryCollection                             (void) const { return m_progCollection;         }
 
        // Default instance & device, selected with --deqp-vk-device-id=N
-       deUint32                                                                        getInstanceVersion                              (void) const;
+       deUint32                                                                        getAvailableInstanceVersion             (void) const;
        const std::vector<std::string>&                         getInstanceExtensions                   (void) const;
        vk::VkInstance                                                          getInstance                                             (void) const;
        const vk::InstanceInterface&                            getInstanceInterface                    (void) const;
index c0d4cbd..aeca298 100644 (file)
@@ -873,16 +873,30 @@ def writeFunctionPtrTypes (api, filename):
        writeInlFile(filename, INL_HEADER, indentLines(genTypes()))
 
 def writeFunctionPointers (api, filename, functionTypes):
-       writeInlFile(filename, INL_HEADER, indentLines(["%s\t%s;" % (getFunctionTypeName(function), getInterfaceName(function)) for function in api.functions if (function.getType() in functionTypes and not function.isAlias)]))
+       def FunctionsYielder ():
+               for function in api.functions:
+                       if function.getType() in functionTypes:
+                               if function.isAlias:
+                                       if function.getType() == Function.TYPE_INSTANCE and function.arguments[0].getType() == "VkPhysicalDevice":
+                                               yield "%s\t%s;" % (getFunctionTypeName(function), getInterfaceName(function))
+                               else:
+                                       yield "%s\t%s;" % (getFunctionTypeName(function), getInterfaceName(function))
+
+       writeInlFile(filename, INL_HEADER, indentLines(FunctionsYielder()))
 
 def writeInitFunctionPointers (api, filename, functionTypes, cond = None):
        def makeInitFunctionPointers ():
                for function in api.functions:
-                       if function.getType() in functionTypes and not function.isAlias and (cond == None or cond(function)):
-                               yield "m_vk.%s\t= (%s)\tGET_PROC_ADDR(\"%s\");" % (getInterfaceName(function), getFunctionTypeName(function), function.name)
-                               if function.alias != None:
-                                       yield "if (!m_vk.%s)" % (getInterfaceName(function))
-                                       yield "    m_vk.%s\t= (%s)\tGET_PROC_ADDR(\"%s\");" % (getInterfaceName(function), getFunctionTypeName(function), function.alias.name)
+                       if function.getType() in functionTypes and (cond == None or cond(function)):
+                               interfaceName = getInterfaceName(function)
+                               if function.isAlias:
+                                       if function.getType() == Function.TYPE_INSTANCE and function.arguments[0].getType() == "VkPhysicalDevice":
+                                               yield "m_vk.%s\t= (%s)\tGET_PROC_ADDR(\"%s\");" % (getInterfaceName(function), getFunctionTypeName(function), function.name)
+                               else:
+                                       yield "m_vk.%s\t= (%s)\tGET_PROC_ADDR(\"%s\");" % (getInterfaceName(function), getFunctionTypeName(function), function.name)
+                                       if function.alias != None:
+                                               yield "if (!m_vk.%s)" % (getInterfaceName(function))
+                                               yield "    m_vk.%s\t= (%s)\tGET_PROC_ADDR(\"%s\");" % (getInterfaceName(function), getFunctionTypeName(function), function.alias.name)
        lines = [line.replace('    ', '\t') for line in indentLines(makeInitFunctionPointers())]
        writeInlFile(filename, INL_HEADER, lines)
 
@@ -899,6 +913,13 @@ def writeFuncPtrInterfaceImpl (api, filename, functionTypes, className):
                                        yield ""
                                        yield " *pApiVersion = VK_API_VERSION_1_0;"
                                        yield " return VK_SUCCESS;"
+                               elif function.getType() == Function.TYPE_INSTANCE and function.arguments[0].getType() == "VkPhysicalDevice" and function.alias != None:
+                                       yield " vk::VkPhysicalDeviceProperties props;"
+                                       yield " m_vk.getPhysicalDeviceProperties(physicalDevice, &props);"
+                                       yield " if (props.apiVersion >= VK_API_VERSION_1_1)"
+                                       yield "         %sm_vk.%s(%s);" % ("return " if function.returnType != "void" else "", getInterfaceName(function), ", ".join(a.name for a in function.arguments))
+                                       yield " else"
+                                       yield "         %sm_vk.%s(%s);" % ("return " if function.returnType != "void" else "", getInterfaceName(function.alias), ", ".join(a.name for a in function.arguments))
                                else:
                                        yield " %sm_vk.%s(%s);" % ("return " if function.returnType != "void" else "", getInterfaceName(function), ", ".join(a.name for a in function.arguments))
                                yield "}"