diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a388344..4498abcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,15 @@ # Release Notes -## [Vulkan Profiles Tools 1.4.3XX](https://github.com/KhronosGroup/Vulkan-Profiles/tree/main) - July 2026 +## [Vulkan Profiles Tools 1.4.3XX](https://github.com/KhronosGroup/Vulkan-Profiles/tree/main) - September 2026 + +### Features: +- Implement `VK_NO_PROTOTYPES` support #734 + +### Deprecation: +- Require Vulkan 1.1 + +## [Vulkan Profiles Tools 1.4.356](https://github.com/KhronosGroup/Vulkan-Profiles/tree/sdk-1.4.356.0) - July 2026 ### Features: - Add `profiles.py` python script, to pull dependent extensions into a source profiles file (ALPHA) diff --git a/library/TUTORIAL.md b/library/TUTORIAL.md index 3c127b09..7b91b1b0 100644 --- a/library/TUTORIAL.md +++ b/library/TUTORIAL.md @@ -22,6 +22,9 @@ - [API reference](#api-reference) - [Preprocessor definitions](#preprocessor-definitions) - [Profile support and usage](#profile-support-and-usage) + - [Initializing Vulkan functions object](#initializing-vulkan-functions-object) + - [`VK_NO_PROTOTYPES`](#vk_no_prototypes) + - [Loading instance-level functions](#loading-instance-level-functions) - [Checking instance level support](#checking-instance-level-support) - [Creating instance with profile](#creating-instance-with-profile) - [Checking device level support](#checking-device-level-support) @@ -80,19 +83,42 @@ For more information about the Vulkan Profiles library generation, use the comma The typically expected usage of the Vulkan Profiles library is for applications to target a specific profile with their application and leave it to the Vulkan Profiles library to enable any necessary extensions and features required by that profile. -The Vulkan Header version 1.3.278 introduced the `VpCapabilities` object which broke backward compatibility with previous version of the library. The `VpCapabilities` object enables using the Profiles API library with Vulkan functions provided external. +The Vulkan Header version 1.4.358 introduced the `VpFunctions` object which broke backward compatibility with previous version of the library. The `VpFunctions` object enables using the Profiles API library with Vulkan functions provided external and dynamic Vulkan API loading. While this new API remains at the `BETA` development stage, it's protected by the `VP_USE_OBJECT` `#define` which must be defined to use the new API described bellow. -In order to use the Profiles API library, the application first has to create a `VpCapabilities` object as follows: ```C++ - VpCapabilities capabilities = VK_NULL_HANDLE; + #define VP_USE_OBJECT 1 +``` - VpCapabilitiesCreateInfo createInfo; - createInfo.apiVersion = VK_API_VERSION_1_1; - createInfo.flags = VP_PROFILE_CREATE_STATIC_BIT; - createInfo.pVulkanFunctions = nullptr; +In order to use the Profiles API library, the application first has to create a `VpFunctions` object as follows: +```C++ + VpFunctionsCreateInfo createInfo{}; - vpCreateCapabilities(&createInfo, nullptr, &capabilities); + VpFunctions functions = VK_NULL_HANDLE; + vpCreateFunctions(&createInfo, nullptr, &functions); +``` + +`vpCreateFunctions` allocates the `VpFunctions` object; When `VK_NO_PROTOTYPES` is defined, the object must then be initialized with the global-level Vulkan functions (such as `vkCreateInstance` and `vkEnumerateInstanceExtensionProperties`) by calling `vpInitializeGlobalFunctions`: + +```C++ + VkResult result = vpInitializeGlobalFunctions(functions, dl.vkGetInstanceProcAddr); + assert(result == VK_SUCCESS); +``` + +Alternatively, the Vulkan functions can be provided using `VpFunctionsCreateInfo`, eg: + +```C++ + VpFunctionsCreateInfo createInfo{}; + createInfo.GetInstanceProcAddr = MockVulkanAPI::vkGetInstanceProcAddr; + createInfo.EnumerateInstanceVersion = MockVulkanAPI::vkEnumerateInstanceVersion; + createInfo.EnumerateInstanceExtensionProperties = MockVulkanAPI::vkEnumerateInstanceExtensionProperties; + createInfo.EnumerateDeviceExtensionProperties = MockVulkanAPI::vkEnumerateDeviceExtensionProperties; + createInfo.CreateInstance = MockVulkanAPI::vkCreateInstance; + createInfo.CreateDevice = MockVulkanAPI::vkCreateDevice; + createInfo.GetPhysicalDeviceFeatures2 = MockVulkanAPI::vkGetPhysicalDeviceFeatures2; + createInfo.GetPhysicalDeviceFormatProperties2 = MockVulkanAPI::vkGetPhysicalDeviceFormatProperties2; + createInfo.GetPhysicalDeviceProperties2 = MockVulkanAPI::vkGetPhysicalDeviceProperties2; + createInfo.GetPhysicalDeviceQueueFamilyProperties2 = MockVulkanAPI::vkGetPhysicalDeviceQueueFamilyProperties2; ``` Then the application has to make sure that the Vulkan implementation supports the selected profile as follows: @@ -104,7 +130,7 @@ Then the application has to make sure that the Vulkan implementation supports th VP_KHR_ROADMAP_2022_SPEC_VERSION }; - result = vpGetInstanceProfileSupport(capabilities, nullptr, &profile, &supported); + result = vpGetInstanceProfileSupport(functions, nullptr, &profile, &supported); if (result != VK_SUCCESS) { // something went wrong ... @@ -135,7 +161,7 @@ If the profile is supported by the Vulkan implementation at the instance level, vpCreateInfo.pEnabledFullProfiles = &profile; VkInstance instance = VK_NULL_HANDLE; - result = vpCreateInstance(capabilities, &vpCreateInfo, nullptr, &instance); + result = vpCreateInstance(functions, &vpCreateInfo, nullptr, &instance); if (result != VK_SUCCESS) { // something went wrong ... @@ -144,9 +170,21 @@ If the profile is supported by the Vulkan implementation at the instance level, The above code example will create a Vulkan instance with the API version and instance extensions required by the profile (unless the application overrides any of them, as explained later). -Make sure to set the `apiVersion` in the `VkApplicationInfo` structure at least to the minimum API version required by the profile, as seen above, to ensure the correct Vulkan API version is used. +Make sure to set the `apiVersion` in the `VkApplicationInfo` structure at least to the minimum API version required by the profile, as seen above, to ensure the correct Vulkan API version is used. If `pApplicationInfo` is null, then `vpCreateInstance` will use the profile Vulkan version. -Once a Vulkan instance is created, the application can check whether individual physical devices support the selected profile as follows: +When a Vulkan instance is created, the `VpFunctions` object initialize the instance-level Vulkan functions (such as `vkCreateDevice` and `vkGetPhysicalDeviceFeatures2`) it needs for device-level queries and device creation. However, `vpCreateInstance` doesn't override the `VpFunctionsCreateInfo` the provided instance-level Vulkan functions. + +However, if the application doesn't use `vpCreateInstance` but `vkCreateInstance` for instance creation, instance-level Vulkan functions can be loaded using `vpInitializeInstanceFunctions`. + +```C++ + result = vpInitializeInstanceFunctions(functions, instance, 0); + if (result != VK_SUCCESS) { + // something went wrong + ... + } +``` + +Once the instance-level functions are loaded, the application can check whether individual physical devices support the selected profile as follows: ```C++ result = vpGetPhysicalDeviceProfileSupport(capabilities, instance, physicalDevice, @@ -175,7 +213,7 @@ Finally, once a physical device supporting the profile is selected, a Vulkan dev vpCreateInfo.pEnabledFullProfiles = &profile; VkDevice device = VK_NULL_HANDLE; - result = vpCreateDevice(capabilities, physicalDevice, &vpCreateInfo, nullptr, &device); + result = vpCreateDevice(functions, physicalDevice, &vpCreateInfo, nullptr, &device); if (result != VK_SUCCESS) { // something went wrong ... @@ -264,20 +302,97 @@ Where: The Vulkan Profile library offers a set of APIs to verify support for a particular Vulkan profile and to create Vulkan instances and devices using the extensions and features required by the profile. +#### Initializing Vulkan functions object + +After a `VpFunctions` object is allocated with `vpCreateFunctions`, it must be initialized with the global-level Vulkan functions it needs by calling the following command: + +```C++ +VkResult vpCreateFunctions( + const VpFunctionsCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VpFunctions* pFunctions); +``` + +Where: +* `pCreateInfo` is a pointer to the `VpFunctionsCreateInfo` structure specifying how the library should resolve the Vulkan functions it needs. +* `pAllocator` controls host memory allocation and is analogous to the corresponding parameter of `vkCreateInstance`. +* `pFunctions` points to a `VpFunctions` handle in which the resulting instance is returned. + +The `VpFunctionCreateInfo` structure is defined as follows: + +```C++ +typedef struct VpFunctionsCreateInfo +{ + /// Flags reserved for future usages + VpFunctionsCreateFlags flags; + + PFN_vkGetInstanceProcAddr GetInstanceProcAddr = nullptr; + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = nullptr; + PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties = nullptr; + PFN_vkCreateInstance CreateInstance = nullptr; + PFN_vkCreateDevice CreateDevice = nullptr; + PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2 = nullptr; + PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2 = nullptr; + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2 = nullptr; +} VpFunctionsCreateInfo; +``` + +Note that `VpFunctionsCreateInfo` doesn't include a `GetDeviceProcAddr` member, as device-level functions are now resolved through the instance rather than through a device proc addr loader. + +The `VpFunctionsCreateInfo` structure allows the application to explicitly provide any of the Vulkan function pointers the library needs (overriding or supplementing the ones resolved automatically) + +#### `VK_NO_PROTOTYPES` + +When `VK_NO_PROTOTYPES` is defined, the `VpFunctions` object are not initialized with the default static Vulkan functions. As a result, Vulkan functions must be initialized either using `VpFunctionsCreateInfo` function pointers or using `vpInitializeGlobalFunctions` and `vpInitializeInstanceFunctions` functions. Otherwise, the profiles APIs will return a `VK_ERROR_INITIALIZATION_FAILED` error. + +#### Loading instance-level functions + +Once a Vulkan instance has been created, the instance-level Vulkan functions the library needs for device-level queries and device creation (such as `vkCreateDevice` and `vkGetPhysicalDeviceFeatures2`) must be loaded by calling the following command: + +```C++ +VkResult vpInitializeInstanceFunctions( + VpFunctions functions, + VkInstance instance, + VpInstanceFunctionsLoadFlags flags); +``` + +Where: +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. +* `instance` is the Vulkan instance to load the instance-level functions from. +* `flags` is a bitmask of `VpInstanceFunctionsLoadFlagBits` indicating additional entry point variants to try when loading. + +The `VpInstanceFunctionsLoadFlagBits` enumeration is defined as follows: + +```C++ +typedef enum VpInstanceFunctionsLoadFlagBits { + VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT = (1 << 0), + VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT = (1 << 1), + VP_INSTANCE_FUNCTIONS_LOAD_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VpInstanceFunctionsLoadFlagBits; +``` + +If `VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT` is specified, and the core `vkGetPhysicalDeviceFeatures2`/`vkGetPhysicalDeviceProperties2`/`vkGetPhysicalDeviceFormatProperties2`/`vkGetPhysicalDeviceQueueFamilyProperties2` entry points are not available, the library falls back to loading their `VK_KHR_get_physical_device_properties2` (`...KHR`) variants instead. This is useful when targeting a Vulkan 1.0 implementation that only supports the extension. + +If `VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT` is specified, only uninitilized functions will be loaded. This flag prevents overwritting Vulkan functions set with `VpFunctionCreateInfo`. + +`vpInitializeInstanceFunctions` may be called after `vpCreateInstance` (or after any other means of instance creation) and before querying device-level profile support or creating a device with `vpCreateDevice`. + #### Checking instance level support In order to query whether the Vulkan implementation supports the necessary instance level requirements (API version and instance extensions) of a particular profile, use the following command: ```C++ VkResult vpGetInstanceProfileSupport( - VpCapabilities capabilities, + VpFunctions functions, const char* pLayerName, const VpProfileProperties* pProfile, VkBool32* pSupported); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pLayerName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming the layer to retrieve extensions from (analogous to the corresponding parameter of `vkEnumerateInstanceExtensionProperties`). * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile to check support for. * `pSupported` is a pointer to a `VkBool32`, which is set to `VK_TRUE` to indicate support, and `VK_FALSE` otherwise. @@ -299,7 +414,7 @@ When a profile supports multiple variants, it might be useful to know what capab ```C++ VkResult vpGetInstanceProfileVariantsSupport( - VpCapabilities capabilities, + VpFunctions functions, const char* pLayerName, const VpProfileProperties* pProfile, VkBool32* pSupported, @@ -308,7 +423,7 @@ VkResult vpGetInstanceProfileVariantsSupport( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pLayerName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming the layer to retrieve extensions from (analogous to the corresponding parameter of `vkEnumerateInstanceExtensionProperties`). * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile to check support for. * `pSupported` is a pointer to a `VkBool32`, which is set to `VK_TRUE` to indicate support, and `VK_FALSE` otherwise. @@ -331,14 +446,14 @@ The Vulkan Profiles library provides the following helper function that enables ```C++ VkResult vpCreateInstance( - VpCapabilities capabilities, + VpFunctions functions, const VpInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pCreateInfo` is a pointer to the `VpInstanceCreateInfo` structure specifying the instance creation info, as described below. * `pAllocator` controls host memory allocation and is analogous to the corresponding parameter of `vkCreateInstance`. * `pInstance` points to a `VkInstance` handle in which the resulting instance is returned. @@ -374,7 +489,7 @@ In order to query whether a Vulkan physical device supports the necessary device ```C++ VkResult vpGetPhysicalDeviceProfileSupport( - VpCapabilities capabilities, + VpFunctions functions, VkInstance instance, VkPhysicalDevice physicalDevice, const VpProfileProperties* pProfile, @@ -382,7 +497,7 @@ VkResult vpGetPhysicalDeviceProfileSupport( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `instance` is the Vulkan instance. * `physicalDevice` is the physical device to check support on. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile to check support for. @@ -401,7 +516,7 @@ When a profile supports multiple variants, it might be useful to know what capab ```C++ VkResult vpGetPhysicalDeviceProfileVariantsSupport( - VpCapabilities capabilities, + VpFunctions functions, VkInstance instance, VkPhysicalDevice physicalDevice, const VpProfileProperties* pProfile, @@ -411,7 +526,7 @@ VkResult vpGetPhysicalDeviceProfileVariantsSupport( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `instance` is the Vulkan instance. * `physicalDevice` is the physical device to check support on. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile to check support for. @@ -435,7 +550,7 @@ The Vulkan Profiles library provides the following helper function that enables ```C++ VkResult vpCreateDevice( - VpCapabilities capabilities, + VpFunctions functions, VkPhysicalDevice physicalDevice, const VpDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, @@ -443,7 +558,7 @@ VkResult vpCreateDevice( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `physicalDevice` is the physical device to create the logical device for. * `pCreateInfo` is a pointer to the `VpDeviceCreateInfo` structure specifying the device creation info, as described below. * `pAllocator` controls host memory allocation and is analogous to the corresponding parameter of `vkCreateDevice`. @@ -501,13 +616,13 @@ In order to query the list of available profiles, use the following command: ```C++ VkResult vpGetProfiles( - VpCapabilities capabilities, + VpFunctions functions, uint32_t* pPropertyCount, VpProfileProperties* pProperties); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pPropertyCount` is a pointer to an integer related to the number of profiles available or queried, as described below. * `pProperties` is either `NULL` or a pointer to an array of `VpProfileProperties` structures. @@ -519,14 +634,14 @@ Some profiles require other profiles. In order to query the list of required pro ```C++ VkResult vpGetProfileRequiredProfiles( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, uint32_t* pPropertyCount, VpProfileProperties* pProperties); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile whose required profiles are queried. * `pPropertyCount` is a pointer to an integer related to the number of required profiles available or queried, as described below. * `pProperties` is either `NULL` or a pointer to an array of `VpProfileProperties` structures. @@ -541,13 +656,13 @@ In order to query whether a Vulkan profile has multiple variants, use the follow ```C++ VkResult vpHasMultipleVariantsProfile( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, VkBool32* pHasMultipleVariants); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile whose property is queried. * `pHasMultipleVariants` is a pointer to a `VkBook32` indicating whether the profiles has multiple variants. @@ -559,12 +674,12 @@ In order to query the required Vulkan API version for a given profile, use the f ```C++ uint32_t vpGetProfileAPIVersion( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile whose required Vulkan API version is queried. If a profile requires other profiles, `vpGetProfileAPIVersion` will look for the required Vulkan API version of each profile and return the newest Vulkan API version among all the profiles. @@ -575,14 +690,14 @@ Some profiles have recommended fallback profiles, i.e. profiles to use as a fall ```C++ VkResult vpGetProfileFallbacks( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, uint32_t* pPropertyCount, VpProfileProperties* pProperties); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the profile whose fallback profiles are queried. * `pPropertyCount` is a pointer to an integer related to the number of fallback profiles available or queried, as described below. * `pProperties` is either `NULL` or a pointer to an array of `VpProfileProperties` structures. @@ -595,7 +710,7 @@ In order to query the list of instance extensions required by a profile, use the ```C++ VkResult vpGetProfileInstanceExtensionProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pPropertyCount, @@ -603,7 +718,7 @@ VkResult vpGetProfileInstanceExtensionProperties( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pPropertyCount` is a pointer to an integer related to the number of instance extensions available or queried, as described below. @@ -618,7 +733,7 @@ In order to query the list of device extensions required by a profile, use the f ```C++ VkResult vpGetProfileDeviceExtensionProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pPropertyCount, @@ -626,7 +741,7 @@ VkResult vpGetProfileDeviceExtensionProperties( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pPropertyCount` is a pointer to an integer related to the number of device extensions available or queried, as described below. @@ -641,7 +756,7 @@ In order to query the structure types of the Vulkan device feature structures fo ```C++ VkResult vpGetProfileFeatureStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pStructureTypeCount, @@ -649,7 +764,7 @@ VkResult vpGetProfileFeatureStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pStructureTypeCount` is a pointer to an integer related to the number of device feature structure types available or queried, as described below. @@ -662,14 +777,14 @@ In order to query the device features required by a profile, use the following c ```C++ VkResult vpGetProfileFeatures( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, void* pNext); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pNext` is a `pNext` chain of Vulkan device feature structures (with or without a `VkPhysicalDeviceFeatures2` feature structure). @@ -683,7 +798,7 @@ In order to query the structure types of the Vulkan device property structures f ```C++ VkResult vpGetProfilePropertyStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pStructureTypeCount, @@ -691,7 +806,7 @@ VkResult vpGetProfilePropertyStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pStructureTypeCount` is a pointer to an integer related to the number of device property structure types available or queried, as described below. @@ -704,14 +819,14 @@ In order to query the device properties required by a profile, use the following ```C++ VkResult vpGetProfileProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, void* pNext); ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pNext` is a `pNext` chain of Vulkan device property structures (with or without a `VkPhysicalDeviceProperties2` property structure). @@ -725,7 +840,7 @@ If the `pNext` chain contains a Vulkan device property structure for which the p In order to query the structure types of the Vulkan queue family property structures for which the profile defines requirements, use the following command: ```C++ VkResult vpGetProfileQueueFamilyStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pStructureTypeCount, @@ -733,7 +848,7 @@ VkResult vpGetProfileQueueFamilyStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pStructureTypeCount` is a pointer to an integer related to the number of queue family property structure types available or queried, as described below. @@ -746,7 +861,7 @@ In order to query the queue family properties required by a profile, use the fol ```C++ VkResult vpGetProfileQueueFamilyProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pPropertyCount, @@ -754,7 +869,7 @@ VkResult vpGetProfileQueueFamilyProperties( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pPropertyCount` is a pointer to an integer related to the number of queue family properties available or queried, as described below. @@ -771,7 +886,7 @@ In order to query the structure types of the Vulkan format property structures f ```C++ VkResult vpGetProfileFormatStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pStructureTypeCount, @@ -779,7 +894,7 @@ VkResult vpGetProfileFormatStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pStructureTypeCount` is a pointer to an integer related to the number of format property structure types available or queried, as described below. @@ -792,7 +907,7 @@ In order to query the list of formats required by a profile, use the following c ```C++ VkResult vpGetProfileFormats( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pFormatCount, @@ -800,7 +915,7 @@ VkResult vpGetProfileFormats( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pFormatCount` is a pointer to an integer related to the number of formats available or queried, as described below. @@ -813,7 +928,7 @@ In order to query the format properties required by a profile for a specific for ```C++ VkResult vpGetProfileFormatProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, VkFormat format, @@ -821,7 +936,7 @@ VkResult vpGetProfileFormatProperties( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `format` is the format for which required properties are queried. @@ -836,7 +951,7 @@ In order to query the list of video profile names required by a profile, use the ```C++ VkResult vpGetProfileVideoProfiles( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pVideoProfileCount, @@ -844,7 +959,7 @@ VkResult vpGetProfileVideoProfiles( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `pVideoProfileCount` is a pointer to an integer related to the number of video profiles available or queried, as described below. @@ -857,7 +972,7 @@ In order to query the structure types of the Vulkan video profile info structure ```C++ VkResult vpGetProfileVideoProfileInfoStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -866,7 +981,7 @@ VkResult vpGetProfileVideoProfileInfoStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. @@ -881,7 +996,7 @@ In order to query the video profile info structures the profile defines for a sp ```C++ VkResult vpGetProfileVideoProfileInfo( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -889,7 +1004,7 @@ VkResult vpGetProfileVideoProfileInfo( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. @@ -903,7 +1018,7 @@ In order to query the structure types of the Vulkan video capability structures ```C++ VkResult vpGetProfileVideoCapabilityStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -912,7 +1027,7 @@ VkResult vpGetProfileVideoCapabilityStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. @@ -927,7 +1042,7 @@ In order to query the video capabilities the profile requires for a specific vid ```C++ VkResult vpGetProfileVideoCapabilities( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -935,7 +1050,7 @@ VkResult vpGetProfileVideoCapabilities( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. @@ -949,7 +1064,7 @@ In order to query the structure types of the Vulkan video format property struct ```C++ VkResult vpGetProfileVideoFormatStructureTypes( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -958,7 +1073,7 @@ VkResult vpGetProfileVideoFormatStructureTypes( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. @@ -973,7 +1088,7 @@ In order to query the video format properties the profile requires for a specifi ```C++ VkResult vpGetProfileVideoFormatProperties( - VpCapabilities capabilities, + VpFunctions functions, const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, @@ -982,7 +1097,7 @@ VkResult vpGetProfileVideoFormatProperties( ``` Where: -* `capabilities` must be one of the capabilities handles returned from a call to `vpCreateCapabilities`. +* `functions` must be one of the functions handles returned from a call to `vpCreateFunctions`. * `pProfile` is a pointer to the `VpProfileProperties` structure specifying the queried profile. * `pBlockName` is either `NULL` or a pointer to a null-terminated UTF-8 string naming identifying a capabilities block of a profile. * `videoProfileIndex` is the index of the video profile to query. diff --git a/library/test/CMakeLists.txt b/library/test/CMakeLists.txt index e64888ae..fa8e455c 100644 --- a/library/test/CMakeLists.txt +++ b/library/test/CMakeLists.txt @@ -235,3 +235,22 @@ add_unit_test_simple(test_mocked_api_create_device) if (NOT ANDROID) add_unit_test_simple(test_mocked_api_generated_library) endif() + +function(add_unit_test_no_prototypes NAME) + set(TEST_FILE ./${NAME}.cpp) + set(TEST_NAME VpLibrary_${NAME}) + + add_executable(${TEST_NAME} ${TEST_FILE}) + if(MSVC) + target_compile_options(${TEST_NAME} PRIVATE /bigobj) + endif() + target_compile_definitions(${TEST_NAME} PUBLIC "VK_NO_PROTOTYPES=1") + target_compile_definitions(${TEST_NAME} PUBLIC "VK_ENABLE_BETA_EXTENSIONS=1") + target_include_directories(${TEST_NAME} PUBLIC "${vulkan-headers_SOURCE_DIR}/include") + target_link_libraries(${TEST_NAME} PRIVATE GTest::gtest GTest::gtest_main Vulkan::Headers Vulkan::Profiles Vulkan::CompilerConfiguration Vulkan::CompilerConfigurationExtra) + add_dependencies(${TEST_NAME} VpGenerated VpLibrary_test_generated_library) + add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} --gtest_catch_exceptions=0) + set_target_properties(${TEST_NAME} PROPERTIES FOLDER "Profiles API library") +endfunction() + +add_unit_test_no_prototypes(test_api_no_prototypes_loading) diff --git a/library/test/mock_vulkan_api.hpp b/library/test/mock_vulkan_api.hpp index 8cb158ec..60e9725e 100644 --- a/library/test/mock_vulkan_api.hpp +++ b/library/test/mock_vulkan_api.hpp @@ -31,6 +31,10 @@ #include #include +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + struct VulkanStructData { VkStructureType sType; std::vector contents; @@ -177,6 +181,7 @@ class MockVulkanAPI final VkPhysicalDevice vkPhysicalDevice; VkDevice vkDevice; VkAllocationCallbacks vkAllocator; + VpFunctions functions; MockVulkanAPI() : m_instanceProcAddr{} @@ -198,10 +203,27 @@ class MockVulkanAPI final , vkAllocator{} { sInstance = this; + + VpFunctionsCreateInfo functionsCreateInfo{}; + functionsCreateInfo.GetInstanceProcAddr = MockVulkanAPI::vkGetInstanceProcAddr; + functionsCreateInfo.EnumerateInstanceVersion = MockVulkanAPI::vkEnumerateInstanceVersion; + functionsCreateInfo.EnumerateInstanceExtensionProperties = MockVulkanAPI::vkEnumerateInstanceExtensionProperties; + functionsCreateInfo.EnumerateDeviceExtensionProperties = MockVulkanAPI::vkEnumerateDeviceExtensionProperties; + functionsCreateInfo.CreateInstance = MockVulkanAPI::vkCreateInstance; + functionsCreateInfo.CreateDevice = MockVulkanAPI::vkCreateDevice; + functionsCreateInfo.GetPhysicalDeviceFeatures2 = MockVulkanAPI::vkGetPhysicalDeviceFeatures2; + functionsCreateInfo.GetPhysicalDeviceFormatProperties2 = MockVulkanAPI::vkGetPhysicalDeviceFormatProperties2; + functionsCreateInfo.GetPhysicalDeviceProperties2 = MockVulkanAPI::vkGetPhysicalDeviceProperties2; + functionsCreateInfo.GetPhysicalDeviceQueueFamilyProperties2 = MockVulkanAPI::vkGetPhysicalDeviceQueueFamilyProperties2; + + VkResult result = vpCreateFunctions(&functionsCreateInfo, nullptr, &this->functions); + assert(result == VK_SUCCESS); } ~MockVulkanAPI() { + vpDestroyFunctions(this->functions, nullptr); + sInstance = nullptr; } @@ -255,6 +277,7 @@ class MockVulkanAPI final void SetInstanceAPIVersion(uint32_t version) { + VpInstanceFunctionsLoadFlags loadInstanceFlags{}; m_instanceAPIVersion = version; if (version >= VK_API_VERSION_1_1) { AddInstanceProc(nullptr, "vkEnumerateInstanceVersion", &vkEnumerateInstanceVersion); @@ -275,6 +298,7 @@ class MockVulkanAPI final RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceProperties2"); RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceFormatProperties2"); RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceQueueFamilyProperties2"); + loadInstanceFlags = VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT; } } diff --git a/library/test/test_api_no_prototypes_loading.cpp b/library/test/test_api_no_prototypes_loading.cpp new file mode 100644 index 00000000..815e1c10 --- /dev/null +++ b/library/test/test_api_no_prototypes_loading.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2021-2026 LunarG, Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + +#ifndef VK_NO_PROTOTYPES +#define VK_NO_PROTOTYPES 1 +#endif + +#ifndef VP_DISABLE_STATIC_LINKING +#define VP_DISABLE_STATIC_LINKING 1 +#endif + +#ifndef VULKAN_PROFILES_HEADER_ONLY +#include +#else +#include +#endif + +#include +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + + int result = RUN_ALL_TESTS(); + + return result; +} + +TEST(no_prototypes, create_instance_with_dynamic_pointers) { + vk::detail::DispatchLoaderDynamic dl; + dl.init(); + + VpFunctionsCreateInfo functionsCreateInfo{}; + + VpFunctions functions; + vpCreateFunctions(&functionsCreateInfo, nullptr, &functions); + + EXPECT_TRUE(vpInitializeGlobalFunctions(functions, dl.vkGetInstanceProcAddr) == VK_SUCCESS); + + VkApplicationInfo ai{}; + ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + ai.pApplicationName = "Testing scaffold"; + ai.applicationVersion = VK_MAKE_VERSION(1, 2, 0); + ai.pEngineName = "No Engine"; + ai.engineVersion = VK_MAKE_VERSION(1, 2, 0); + ai.apiVersion = VK_API_VERSION_1_2; + + VkInstanceCreateInfo ici{}; + ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + ici.pApplicationInfo = &ai; + +#if defined(__APPLE__) + const char* extensions[] = { VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME }; + ici.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + ici.enabledExtensionCount = 1; + ici.ppEnabledExtensionNames = extensions; +#endif + + VpInstanceCreateInfo createInfo{ &ici, 0, 0, nullptr }; + + VkInstance instance = VK_NULL_HANDLE; + EXPECT_TRUE(vpCreateInstance(functions, &createInfo, nullptr, &instance) == VK_SUCCESS); +} diff --git a/library/test/test_api_profile_object.cpp b/library/test/test_api_profile_object.cpp index 7c31ee57..2a5eb922 100644 --- a/library/test/test_api_profile_object.cpp +++ b/library/test/test_api_profile_object.cpp @@ -18,6 +18,10 @@ * - Christophe Riccio */ +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + #define VK_ENABLE_BETA_EXTENSIONS 1 #include "test.hpp" @@ -48,50 +52,44 @@ int main(int argc, char** argv) { return result; } -struct Capabilities { - VpCapabilities handle = VK_NULL_HANDLE; - - Capabilities() { - VpVulkanFunctions vulkanFunctions; - vulkanFunctions.GetInstanceProcAddr = vkGetInstanceProcAddr; - vulkanFunctions.GetDeviceProcAddr = vkGetDeviceProcAddr; - vulkanFunctions.EnumerateInstanceVersion = vkEnumerateInstanceVersion; - vulkanFunctions.EnumerateInstanceExtensionProperties = vkEnumerateInstanceExtensionProperties; - vulkanFunctions.EnumerateDeviceExtensionProperties = vkEnumerateDeviceExtensionProperties; - vulkanFunctions.GetPhysicalDeviceFeatures2 = vkGetPhysicalDeviceFeatures2; - vulkanFunctions.GetPhysicalDeviceProperties2 = vkGetPhysicalDeviceProperties2; - vulkanFunctions.GetPhysicalDeviceFormatProperties2 = vkGetPhysicalDeviceFormatProperties2; - vulkanFunctions.GetPhysicalDeviceQueueFamilyProperties2 = vkGetPhysicalDeviceQueueFamilyProperties2; - vulkanFunctions.CreateInstance = vkCreateInstance; - vulkanFunctions.CreateDevice = vkCreateDevice; - - VpCapabilitiesCreateInfo createInfo; - createInfo.apiVersion = VK_API_VERSION_1_1; - createInfo.flags = VP_PROFILE_CREATE_STATIC_BIT; - createInfo.pVulkanFunctions = &vulkanFunctions; - - vpCreateCapabilities(&createInfo, nullptr, &handle); +struct Functions { + VpFunctions handle = VK_NULL_HANDLE; + + Functions() { + VpFunctionsCreateInfo createInfo{}; + createInfo.GetInstanceProcAddr = vkGetInstanceProcAddr; + createInfo.EnumerateInstanceVersion = vkEnumerateInstanceVersion; + createInfo.EnumerateInstanceExtensionProperties = vkEnumerateInstanceExtensionProperties; + createInfo.EnumerateDeviceExtensionProperties = vkEnumerateDeviceExtensionProperties; + createInfo.GetPhysicalDeviceFeatures2 = vkGetPhysicalDeviceFeatures2; + createInfo.GetPhysicalDeviceProperties2 = vkGetPhysicalDeviceProperties2; + createInfo.GetPhysicalDeviceFormatProperties2 = vkGetPhysicalDeviceFormatProperties2; + createInfo.GetPhysicalDeviceQueueFamilyProperties2 = vkGetPhysicalDeviceQueueFamilyProperties2; + createInfo.CreateInstance = vkCreateInstance; + createInfo.CreateDevice = vkCreateDevice; + + vpCreateFunctions(&createInfo, nullptr, &handle); } - ~Capabilities() { - vpDestroyCapabilities(handle, nullptr); + ~Functions() { + vpDestroyFunctions(handle, nullptr); } }; -TEST(api_capabilities_object, check_support_vulkan_1_1) { - Capabilities object; +TEST(fucntions_object, check_support_vulkan_1_1) { + Functions functions; const VpProfileProperties profileProperties = {VP_LUNARG_MINIMUM_REQUIREMENTS_1_1_NAME, VP_LUNARG_MINIMUM_REQUIREMENTS_1_1_SPEC_VERSION}; VkBool32 supported = VK_FALSE; VkResult result = vpGetPhysicalDeviceProfileSupport( - object.handle, scaffold->instance, scaffold->physicalDevice, &profileProperties, &supported); + functions.handle, scaffold->instance, scaffold->physicalDevice, &profileProperties, &supported); EXPECT_TRUE(result == VK_SUCCESS); EXPECT_TRUE(supported == VK_TRUE); } -TEST(api_capabilities_object, overrite_with_unsupported_extensions) { - Capabilities object; +TEST(fucntions_object, overrite_with_unsupported_extensions) { + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; @@ -115,21 +113,21 @@ TEST(api_capabilities_object, overrite_with_unsupported_extensions) { VkDevice device = VK_NULL_HANDLE; VkResult res = vpCreateDevice( - object.handle, scaffold->physicalDevice, &profileInfo, nullptr, &device); + functions.handle, scaffold->physicalDevice, &profileInfo, nullptr, &device); EXPECT_TRUE(res != VK_SUCCESS); EXPECT_TRUE(device == VK_NULL_HANDLE); } TEST(api_capabilities_object, get_profiles) { - Capabilities object; + Functions functions; uint32_t propertyCount = 0; - VkResult result0 = vpGetProfiles(object.handle, &propertyCount, nullptr); + VkResult result0 = vpGetProfiles(functions.handle, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_TRUE(propertyCount > 1); std::vector properties(propertyCount); - VkResult result1 = vpGetProfiles(object.handle, &propertyCount, &properties[0]); + VkResult result1 = vpGetProfiles(functions.handle, &propertyCount, &properties[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_TRUE(propertyCount > 1); @@ -138,63 +136,63 @@ TEST(api_capabilities_object, get_profiles) { } TEST(api_capabilities_object, get_api_version) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; - uint32_t version = vpGetProfileAPIVersion(object.handle, &profileProperties); + uint32_t version = vpGetProfileAPIVersion(functions.handle, &profileProperties); EXPECT_EQ(VK_MAKE_API_VERSION(0, 1, 3, 204), version); } TEST(api_capabilities_object, get_required_profiles) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2024_NAME, VP_KHR_ROADMAP_2024_SPEC_VERSION}; uint32_t propertyCount = 0; - VkResult result0 = vpGetProfileRequiredProfiles(object.handle, &profileProperties, &propertyCount, nullptr); + VkResult result0 = vpGetProfileRequiredProfiles(functions.handle, &profileProperties, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_TRUE(propertyCount == 1); } TEST(api_capabilities_object, get_profile_fallback) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t count = 0; - VkResult result0 = vpGetProfileFallbacks(object.handle, &profileProperties, &count, nullptr); + VkResult result0 = vpGetProfileFallbacks(functions.handle, &profileProperties, &count, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(0, count); count = 1; std::vector data(count); - VkResult result1 = vpGetProfileFallbacks(object.handle, &profileProperties, &count, &data[0]); + VkResult result1 = vpGetProfileFallbacks(functions.handle, &profileProperties, &count, &data[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_EQ(0, count); } TEST(api_capabilities_object, has_multiple_variants_profile) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; VkBool32 has_multiple_variants = VK_TRUE; - VkResult result0 = vpHasMultipleVariantsProfile(object.handle, &profileProperties, &has_multiple_variants); + VkResult result0 = vpHasMultipleVariantsProfile(functions.handle, &profileProperties, &has_multiple_variants); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(VK_FALSE, has_multiple_variants); } TEST(api_capabilities_object, get_profile_device_extension_properties) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t propertyCount = 0; VkResult result0 = vpGetProfileDeviceExtensionProperties( - object.handle, &profileProperties, nullptr, &propertyCount, nullptr); + functions.handle, &profileProperties, nullptr, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(1, propertyCount); @@ -202,7 +200,7 @@ TEST(api_capabilities_object, get_profile_device_extension_properties) { std::vector properties(propertyCount); VkResult result1 = vpGetProfileDeviceExtensionProperties( - object.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); + functions.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_EQ(1, propertyCount); @@ -210,13 +208,13 @@ TEST(api_capabilities_object, get_profile_device_extension_properties) { } TEST(api_capabilities_object, get_profile_instance_extension_properties) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t propertyCount = 0; VkResult result0 = vpGetProfileInstanceExtensionProperties( - object.handle, &profileProperties, nullptr, &propertyCount, nullptr); + functions.handle, &profileProperties, nullptr, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(0, propertyCount); @@ -224,24 +222,24 @@ TEST(api_capabilities_object, get_profile_instance_extension_properties) { std::vector properties(propertyCount); VkResult result1 = vpGetProfileInstanceExtensionProperties( - object.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); + functions.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_EQ(0, propertyCount); } TEST(api_capabilities_object, get_profile_formats) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t formatCount = 0; - VkResult result0 = vpGetProfileFormats(object.handle, &profileProperties, nullptr, &formatCount, nullptr); + VkResult result0 = vpGetProfileFormats(functions.handle, &profileProperties, nullptr, &formatCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(0, formatCount); } TEST(api_capabilities_object, get_profile_properties) { - Capabilities object; + Functions functions; VkPhysicalDeviceProperties2 profileProperties2{}; profileProperties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; @@ -249,7 +247,7 @@ TEST(api_capabilities_object, get_profile_properties) { const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; - vpGetProfileProperties(object.handle, &profileProperties, nullptr, &profileProperties2); + vpGetProfileProperties(functions.handle, &profileProperties, nullptr, &profileProperties2); EXPECT_EQ(8192, profileProperties2.properties.limits.maxImageDimension1D); EXPECT_EQ(8192, profileProperties2.properties.limits.maxImageDimension2D); @@ -260,7 +258,7 @@ TEST(api_capabilities_object, get_profile_properties) { } TEST(api_capabilities_object, get_profile_features) { - Capabilities object; + Functions functions; VkPhysicalDeviceVulkan12Features deviceVulkan12Features = {}; deviceVulkan12Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; @@ -272,7 +270,7 @@ TEST(api_capabilities_object, get_profile_features) { const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; - vpGetProfileFeatures(object.handle, &profileProperties, nullptr, &deviceFeatures2); + vpGetProfileFeatures(functions.handle, &profileProperties, nullptr, &deviceFeatures2); EXPECT_EQ(VK_FALSE, deviceVulkan12Features.samplerMirrorClampToEdge); EXPECT_EQ(VK_FALSE, deviceVulkan12Features.drawIndirectCount); @@ -298,19 +296,19 @@ TEST(api_capabilities_object, get_profile_features) { } TEST(api_capabilities_object, get_profile_feature_structure_types) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t featureCount = 0; VkResult result0 = vpGetProfileFeatureStructureTypes( - object.handle, &profileProperties, nullptr, &featureCount, nullptr); + functions.handle, &profileProperties, nullptr, &featureCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(5, featureCount); std::vector features(featureCount); VkResult result1 = vpGetProfileFeatureStructureTypes( - object.handle, &profileProperties, nullptr, &featureCount, &features[0]); + functions.handle, &profileProperties, nullptr, &featureCount, &features[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_EQ(5, featureCount); @@ -322,19 +320,19 @@ TEST(api_capabilities_object, get_profile_feature_structure_types) { } TEST(api_capabilities_object, get_profile_Property_structure_types) { - Capabilities object; + Functions functions; const VpProfileProperties profileProperties = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; uint32_t propertyCount = 0; VkResult result0 = vpGetProfilePropertyStructureTypes( - object.handle, &profileProperties, nullptr, &propertyCount, nullptr); + functions.handle, &profileProperties, nullptr, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); EXPECT_EQ(4, propertyCount); std::vector properties(propertyCount); VkResult result1 = vpGetProfilePropertyStructureTypes( - object.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); + functions.handle, &profileProperties, nullptr, &propertyCount, &properties[0]); EXPECT_EQ(VK_SUCCESS, result1); EXPECT_EQ(4, propertyCount); diff --git a/library/test/test_mocked_api_create_device.cpp b/library/test/test_mocked_api_create_device.cpp index b5c52aa0..df18adb0 100644 --- a/library/test/test_mocked_api_create_device.cpp +++ b/library/test/test_mocked_api_create_device.cpp @@ -20,9 +20,14 @@ * - Daniel Rakos */ -#include "mock_vulkan_api.hpp" +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + #include +#include "mock_vulkan_api.hpp" + TEST(mocked_api_create_device, default_extensions) { MockVulkanAPI mock; @@ -51,7 +56,7 @@ TEST(mocked_api_create_device, default_extensions) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); mock.SetExpectedDeviceCreateInfo(&outCreateInfo, { VK_STRUCT(outFeatures), @@ -63,7 +68,7 @@ TEST(mocked_api_create_device, default_extensions) { VpDeviceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -104,7 +109,7 @@ TEST(mocked_api_create_device, merge_extensions) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); mock.SetExpectedDeviceCreateInfo(&outCreateInfo, { VK_STRUCT(outFeatures), @@ -116,7 +121,7 @@ TEST(mocked_api_create_device, merge_extensions) { VpDeviceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -149,7 +154,7 @@ TEST(mocked_api_create_device, default_features) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); mock.SetExpectedDeviceCreateInfo(&outCreateInfo, { VK_STRUCT(outFeatures), @@ -161,7 +166,7 @@ TEST(mocked_api_create_device, default_features) { VpDeviceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -204,7 +209,7 @@ TEST(mocked_api_create_device, legacy_enabled_features) { VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11}; outFeatures2.features = inFeatures.features; - vpGetProfileFeatures(&profile, nullptr, &outFeatures2); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures2); mock.SetExpectedDeviceCreateInfo(&outCreateInfo, { VK_STRUCT(outFeatures2), @@ -217,7 +222,7 @@ TEST(mocked_api_create_device, legacy_enabled_features) { VpDeviceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -250,7 +255,7 @@ TEST(mocked_api_create_device, disable_robust_buffer_access) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); outFeatures.features.robustBufferAccess = VK_FALSE; @@ -264,7 +269,7 @@ TEST(mocked_api_create_device, disable_robust_buffer_access) { VpDeviceCreateInfo createInfo{&inCreateInfo, VP_DEVICE_CREATE_DISABLE_ROBUST_BUFFER_ACCESS_BIT, 1, &profile}; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -298,7 +303,7 @@ TEST(mocked_api_create_device, disable_robust_image_access) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); outFeatures13.robustImageAccess = VK_FALSE; @@ -312,7 +317,7 @@ TEST(mocked_api_create_device, disable_robust_image_access) { VpDeviceCreateInfo createInfo{&inCreateInfo, VP_DEVICE_CREATE_DISABLE_ROBUST_IMAGE_ACCESS_BIT, 1, &profile}; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -345,7 +350,7 @@ TEST(mocked_api_create_device, disable_robust_access) { VkPhysicalDeviceVulkan12Features outFeatures12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &outFeatures13 }; VkPhysicalDeviceVulkan11Features outFeatures11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &outFeatures12 }; VkPhysicalDeviceFeatures2 outFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &outFeatures11 }; - vpGetProfileFeatures(&profile, nullptr, &outFeatures); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &outFeatures); outFeatures.features.robustBufferAccess = VK_FALSE; outFeatures13.robustImageAccess = VK_FALSE; @@ -360,7 +365,7 @@ TEST(mocked_api_create_device, disable_robust_access) { VpDeviceCreateInfo createInfo{&inCreateInfo, VP_DEVICE_CREATE_DISABLE_ROBUST_ACCESS, 1, &profile}; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); diff --git a/library/test/test_mocked_api_create_instance.cpp b/library/test/test_mocked_api_create_instance.cpp index 6392ae0b..f82d4e8a 100644 --- a/library/test/test_mocked_api_create_instance.cpp +++ b/library/test/test_mocked_api_create_instance.cpp @@ -20,18 +20,24 @@ * - Daniel Rakos */ -#include "mock_vulkan_api.hpp" +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + +#include #include + #include "generated_vulkan_profiles.hpp" +#include "mock_vulkan_api.hpp" -static void initInstanceExtensions(const VpProfileProperties& profile, std::vector& properties, +static void initInstanceExtensions(const VpFunctions& functions, const VpProfileProperties& profile, std::vector& properties, std::vector& outExtensions) { uint32_t propertyCount = 0; - VkResult result0 = vpGetProfileInstanceExtensionProperties(&profile, nullptr, &propertyCount, nullptr); + VkResult result0 = vpGetProfileInstanceExtensionProperties(functions, &profile, nullptr, &propertyCount, nullptr); EXPECT_EQ(VK_SUCCESS, result0); properties.resize(propertyCount); - VkResult result1 = vpGetProfileInstanceExtensionProperties(&profile, nullptr, &propertyCount, &properties[0]); + VkResult result1 = vpGetProfileInstanceExtensionProperties(functions, &profile, nullptr, &propertyCount, &properties[0]); EXPECT_EQ(VK_SUCCESS, result1); for (std::size_t i = 0, n = properties.size(); i < n; ++i) { @@ -46,7 +52,7 @@ TEST(mocked_api_create_instance, vulkan10_no_app_info) { std::vector properties; std::vector outExtensions; - initInstanceExtensions(profile, properties, outExtensions); + initInstanceExtensions(mock.functions, profile, properties, outExtensions); std::vector dummyLayerNames{ "VK_DUMMY_layer1", "VK_DUMMY_layer2" }; @@ -67,7 +73,7 @@ TEST(mocked_api_create_instance, vulkan10_no_app_info) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); @@ -80,7 +86,7 @@ TEST(mocked_api_create_instance, vulkan10_with_app_info) { std::vector properties; std::vector outExtensions; - initInstanceExtensions(profile, properties, outExtensions); + initInstanceExtensions(mock.functions, profile, properties, outExtensions); std::vector dummyLayerNames{ "VK_DUMMY_layer1" }; @@ -105,7 +111,7 @@ TEST(mocked_api_create_instance, vulkan10_with_app_info) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); @@ -118,7 +124,7 @@ TEST(mocked_api_create_instance, vulkan11) { std::vector properties; std::vector outExtensions; - initInstanceExtensions(profile, properties, outExtensions); + initInstanceExtensions(mock.functions, profile, properties, outExtensions); std::vector dummyLayerNames{ "VK_DUMMY_layer1", "VK_DUMMY_layer2", "VK_DUMMY_layer3" }; @@ -143,7 +149,7 @@ TEST(mocked_api_create_instance, vulkan11) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); @@ -175,7 +181,7 @@ TEST(mocked_api_create_instance, default_extensions) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); @@ -216,7 +222,7 @@ TEST(mocked_api_create_instance, merge_extensions) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); @@ -230,7 +236,7 @@ TEST(mocked_api_create_instance, retain_chained_structs) { std::vector properties; std::vector outExtensions; - initInstanceExtensions(profile, properties, outExtensions); + initInstanceExtensions(mock.functions, profile, properties, outExtensions); int dummyData; VkValidationFlagsEXT validationFlags{ VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT }; @@ -258,7 +264,7 @@ TEST(mocked_api_create_instance, retain_chained_structs) { VpInstanceCreateInfo createInfo{ &inCreateInfo, 0, 1, &profile }; VkInstance instance = VK_NULL_HANDLE; - VkResult result = vpCreateInstance(&createInfo, &mock.vkAllocator, &instance); + VkResult result = vpCreateInstance(mock.functions, &createInfo, &mock.vkAllocator, &instance); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(instance == mock.vkInstance); diff --git a/library/test/test_mocked_api_generated_library.cpp b/library/test/test_mocked_api_generated_library.cpp index 44e0e2c0..86b70ffb 100644 --- a/library/test/test_mocked_api_generated_library.cpp +++ b/library/test/test_mocked_api_generated_library.cpp @@ -19,8 +19,12 @@ * - Christophe Riccio */ -#include "mock_vulkan_api.hpp" +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + #include "test_vulkan_profiles.hpp" +#include "mock_vulkan_api.hpp" void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32_t apiVersion = VK_API_VERSION_1_3, int profileAreas = PROFILE_AREA_ALL_BITS) { @@ -29,34 +33,34 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 if (profileAreas & PROFILE_AREA_EXTENSIONS_BIT) { uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); mock.SetDeviceExtensions(mock.vkPhysicalDevice, extensions); } if (profileAreas & PROFILE_AREA_FEATURES_BIT) { VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features)}); } if (profileAreas & PROFILE_AREA_PROPERTIES_BIT) { VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties({VK_STRUCT(props)}); } if (profileAreas & PROFILE_AREA_QUEUE_FAMILIES_BIT) { uint32_t queue_family_count = 0; - vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, nullptr); + vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, nullptr); std::vector props(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); std::vector video_props(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR, nullptr}); for (uint32_t i = 0; i < queue_family_count; ++i) { props[i].pNext = &video_props[i]; } - vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, props.data()); + vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, props.data()); for (uint32_t i = 0; i < queue_family_count; ++i) { mock.AddQueueFamily({VK_STRUCT(props[i]), VK_STRUCT(video_props[i])}); } @@ -64,14 +68,14 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 if (profileAreas & PROFILE_AREA_FORMATS_BIT) { uint32_t formatCount = 0; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); if (formatCount > 0) { std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, &formats[0]); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, &formats[0]); for (std::size_t i = 0, n = formats.size(); i < n; ++i) { VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); mock.AddFormat(formats[i], {VK_STRUCT(formatProps)}); } } @@ -83,9 +87,9 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 VkVideoProfileInfoKHR profile_info{VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR}; uint32_t struct_type_count = 0; - vpGetProfileVideoProfileInfoStructureTypes(&profile, nullptr, video_profile_index, &struct_type_count, nullptr); + vpGetProfileVideoProfileInfoStructureTypes(mock.functions, &profile, nullptr, video_profile_index, &struct_type_count, nullptr); std::vector struct_types(struct_type_count); - vpGetProfileVideoProfileInfoStructureTypes(&profile, nullptr, video_profile_index, &struct_type_count, struct_types.data()); + vpGetProfileVideoProfileInfoStructureTypes(mock.functions, &profile, nullptr, video_profile_index, &struct_type_count, struct_types.data()); std::vector struct_data{}; for (auto struct_type : struct_types) { @@ -104,7 +108,7 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 } } - vpGetProfileVideoProfileInfo(&profile, nullptr, video_profile_index, &profile_info); + vpGetProfileVideoProfileInfo(mock.functions, &profile, nullptr, video_profile_index, &profile_info); return VulkanVideoProfile(&profile_info); }; @@ -112,19 +116,19 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 mock.InitVideoEntryPoints(); uint32_t video_profile_count = 0; - vpGetProfileVideoProfiles(&profile, nullptr, &video_profile_count, nullptr); + vpGetProfileVideoProfiles(mock.functions, &profile, nullptr, &video_profile_count, nullptr); for (uint32_t video_profile_index = 0; video_profile_index < video_profile_count; ++video_profile_index) { auto video_profile = get_video_profile(video_profile_index); VkVideoDecodeH264CapabilitiesKHR h264_decode{VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR, nullptr}; VkVideoDecodeH265CapabilitiesKHR h265_decode{VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR, &h264_decode}; VkVideoCapabilitiesKHR caps{VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR, &h265_decode}; - vpGetProfileVideoCapabilities(&profile, nullptr, video_profile_index, &caps); + vpGetProfileVideoCapabilities(mock.functions, &profile, nullptr, video_profile_index, &caps); uint32_t struct_type_count = 0; - vpGetProfileVideoCapabilityStructureTypes(&profile, nullptr, video_profile_index, &struct_type_count, nullptr); + vpGetProfileVideoCapabilityStructureTypes(mock.functions, &profile, nullptr, video_profile_index, &struct_type_count, nullptr); std::vector struct_types(struct_type_count); - vpGetProfileVideoCapabilityStructureTypes(&profile, nullptr, video_profile_index, &struct_type_count, + vpGetProfileVideoCapabilityStructureTypes(mock.functions, &profile, nullptr, video_profile_index, &struct_type_count, struct_types.data()); std::vector struct_data{}; @@ -152,17 +156,17 @@ void initProfile(MockVulkanAPI& mock, const VpProfileProperties& profile, uint32 mock.InitVideoEntryPoints(); uint32_t video_profile_count = 0; - vpGetProfileVideoProfiles(&profile, nullptr, &video_profile_count, nullptr); + vpGetProfileVideoProfiles(mock.functions, &profile, nullptr, &video_profile_count, nullptr); for (uint32_t video_profile_index = 0; video_profile_index < video_profile_count; ++video_profile_index) { auto video_profile = get_video_profile(video_profile_index); uint32_t format_count = 0; - vpGetProfileVideoFormatProperties(&profile, nullptr, video_profile_index, &format_count, nullptr); + vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, video_profile_index, &format_count, nullptr); if (format_count > 0) { std::vector props(format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - vpGetProfileVideoFormatProperties(&profile, nullptr, video_profile_index, &format_count, props.data()); + vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, video_profile_index, &format_count, props.data()); for (uint32_t i = 0; i < format_count; ++i) { mock.AddVideoFormat(video_profile, {VK_STRUCT(props[i])}); @@ -248,9 +252,9 @@ TEST(mocked_api_generated_library, create_device) { const VpProfileProperties profile{VP_LUNARG_TEST_PROFILE_B_NAME, VP_LUNARG_TEST_PROFILE_B_SPEC_VERSION}; uint32_t extension_property_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extension_property_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extension_property_count, nullptr); std::vector extension_properties(extension_property_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extension_property_count, &extension_properties[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extension_property_count, &extension_properties[0]); std::vector extensions(extension_property_count); for (std::size_t i = 0, n = extensions.size(); i < n; ++i) { @@ -258,7 +262,7 @@ TEST(mocked_api_generated_library, create_device) { } VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); VkDeviceQueueCreateInfo queueCreateInfo{VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO}; queueCreateInfo.queueFamilyIndex = 0; @@ -277,7 +281,7 @@ TEST(mocked_api_generated_library, create_device) { VpDeviceCreateInfo createInfo{&inCreateInfo, 0, 1, &profile}; VkDevice device = VK_NULL_HANDLE; - VkResult result = vpCreateDevice(mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); + VkResult result = vpCreateDevice(mock.functions, mock.vkPhysicalDevice, &createInfo, &mock.vkAllocator, &device); EXPECT_EQ(result, VK_SUCCESS); EXPECT_TRUE(device == mock.vkDevice); @@ -289,25 +293,25 @@ TEST(mocked_api_generated_library, check_support_profile_a) { const VpProfileProperties profile{VP_LUNARG_TEST_PROFILE_A_NAME, VP_LUNARG_TEST_PROFILE_A_SPEC_VERSION}; VkBool32 multiple_variants = VK_TRUE; - VkResult result = vpHasMultipleVariantsProfile(&profile, &multiple_variants); + VkResult result = vpHasMultipleVariantsProfile(mock.functions, &profile, &multiple_variants); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(multiple_variants, VK_FALSE); - const uint32_t api_version = vpGetProfileAPIVersion(&profile); + const uint32_t api_version = vpGetProfileAPIVersion(mock.functions, &profile); EXPECT_EQ(VK_API_VERSION_MAJOR(api_version), 1); EXPECT_EQ(VK_API_VERSION_MINOR(api_version), 2); EXPECT_EQ(VK_API_VERSION_PATCH(api_version), 224); uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); EXPECT_EQ(props.properties.limits.maxImageDimension1D, 0); EXPECT_EQ(props.properties.limits.maxImageDimension2D, 4096); @@ -322,7 +326,7 @@ TEST(mocked_api_generated_library, check_support_profile_a) { mock.SetDeviceExtensions(mock.vkPhysicalDevice, extensions); VkBool32 supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -334,32 +338,32 @@ TEST(mocked_api_generated_library, check_support_profile_b) { const VpProfileProperties profile{VP_LUNARG_TEST_PROFILE_B_NAME, VP_LUNARG_TEST_PROFILE_B_SPEC_VERSION}; VkBool32 multiple_variants = VK_TRUE; - VkResult result = vpHasMultipleVariantsProfile(&profile, &multiple_variants); + VkResult result = vpHasMultipleVariantsProfile(mock.functions, &profile, &multiple_variants); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(multiple_variants, VK_FALSE); - const uint32_t api_version = vpGetProfileAPIVersion(&profile); + const uint32_t api_version = vpGetProfileAPIVersion(mock.functions, &profile); EXPECT_EQ(VK_API_VERSION_MAJOR(api_version), 1); EXPECT_EQ(VK_API_VERSION_MINOR(api_version), 3); EXPECT_EQ(VK_API_VERSION_PATCH(api_version), 224); uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); EXPECT_STREQ(extensions[0].extensionName, "VK_KHR_get_memory_requirements2"); EXPECT_STREQ(extensions[1].extensionName, "VK_KHR_driver_properties"); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); EXPECT_EQ(features.features.depthBiasClamp, VK_TRUE); EXPECT_EQ(features.features.depthClamp, VK_TRUE); EXPECT_EQ(features.features.drawIndirectFirstInstance, VK_TRUE); VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); EXPECT_EQ(props.properties.limits.maxImageDimension1D, 4096); EXPECT_EQ(props.properties.limits.maxImageDimension2D, 8192); @@ -376,7 +380,7 @@ TEST(mocked_api_generated_library, check_support_profile_b) { mock.SetProperties({VK_STRUCT(props)}); VkBool32 supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -388,26 +392,26 @@ TEST(mocked_api_generated_library, check_support_profile_c) { const VpProfileProperties profile{VP_LUNARG_TEST_PROFILE_C_NAME, VP_LUNARG_TEST_PROFILE_C_SPEC_VERSION}; VkBool32 multiple_variants = VK_TRUE; - VkResult result = vpHasMultipleVariantsProfile(&profile, &multiple_variants); + VkResult result = vpHasMultipleVariantsProfile(mock.functions, &profile, &multiple_variants); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(multiple_variants, VK_FALSE); - const uint32_t api_version = vpGetProfileAPIVersion(&profile); + const uint32_t api_version = vpGetProfileAPIVersion(mock.functions, &profile); EXPECT_EQ(VK_API_VERSION_MAJOR(api_version), 1); EXPECT_EQ(VK_API_VERSION_MINOR(api_version), 3); EXPECT_EQ(VK_API_VERSION_PATCH(api_version), 225); uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); EXPECT_STREQ(extensions[0].extensionName, "VK_KHR_get_memory_requirements2"); EXPECT_STREQ(extensions[1].extensionName, "VK_KHR_driver_properties"); EXPECT_STREQ(extensions[2].extensionName, "VK_KHR_create_renderpass2"); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); EXPECT_EQ(features.features.depthBiasClamp, VK_TRUE); EXPECT_EQ(features.features.depthClamp, VK_TRUE); @@ -415,7 +419,7 @@ TEST(mocked_api_generated_library, check_support_profile_c) { EXPECT_EQ(features.features.fullDrawIndexUint32, VK_TRUE); VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); EXPECT_EQ(props.properties.limits.maxImageDimension1D, 4096); EXPECT_EQ(props.properties.limits.maxImageDimension2D, 16384); @@ -432,7 +436,7 @@ TEST(mocked_api_generated_library, check_support_profile_c) { mock.SetProperties({VK_STRUCT(props)}); VkBool32 supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -444,19 +448,19 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { const VpProfileProperties profile{VP_RASTERGRID_TEST_QUEUE_FAMILIES_NAME, VP_RASTERGRID_TEST_QUEUE_FAMILIES_SPEC_VERSION}; VkBool32 multiple_variants = VK_TRUE; - VkResult result = vpHasMultipleVariantsProfile(&profile, &multiple_variants); + VkResult result = vpHasMultipleVariantsProfile(mock.functions, &profile, &multiple_variants); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(multiple_variants, VK_FALSE); - const uint32_t api_version = vpGetProfileAPIVersion(&profile); + const uint32_t api_version = vpGetProfileAPIVersion(mock.functions, &profile); EXPECT_EQ(VK_API_VERSION_MAJOR(api_version), 1); EXPECT_EQ(VK_API_VERSION_MINOR(api_version), 3); EXPECT_EQ(VK_API_VERSION_PATCH(api_version), 225); uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); EXPECT_EQ(extensions_count, 5); @@ -467,7 +471,7 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { EXPECT_STREQ(extensions[4].extensionName, "VK_KHR_video_queue"); uint32_t queue_family_count = 0; - vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, nullptr); + vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, nullptr); EXPECT_EQ(queue_family_count, 4); @@ -478,7 +482,7 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { for (uint32_t i = 0; i < queue_family_count; ++i) { queue_family_props[i].pNext = &queue_family_video_props[i]; } - vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, queue_family_props.data()); + vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, queue_family_props.data()); EXPECT_EQ(queue_family_count, 4); @@ -507,7 +511,7 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { } VkBool32 supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -528,7 +532,7 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { } supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -553,7 +557,7 @@ TEST(mocked_api_generated_library, check_support_profile_queue_families) { } supported = VK_TRUE; - result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -565,32 +569,32 @@ TEST(mocked_api_generated_library, check_support_variants_reflection) { const VpProfileProperties profile{VP_LUNARG_TEST_VARIANTS_NAME, VP_LUNARG_TEST_VARIANTS_SPEC_VERSION}; VkBool32 multiple_variants = VK_FALSE; - VkResult result = vpHasMultipleVariantsProfile(&profile, &multiple_variants); + VkResult result = vpHasMultipleVariantsProfile(mock.functions, &profile, &multiple_variants); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(multiple_variants, VK_TRUE); - const uint32_t api_version = vpGetProfileAPIVersion(&profile); + const uint32_t api_version = vpGetProfileAPIVersion(mock.functions, &profile); EXPECT_EQ(VK_API_VERSION_MAJOR(api_version), 1); EXPECT_EQ(VK_API_VERSION_MINOR(api_version), 3); EXPECT_EQ(VK_API_VERSION_PATCH(api_version), 204); uint32_t extensions_count = 0; - result = vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + result = vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); std::vector extensions(extensions_count); - result = vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + result = vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); EXPECT_EQ(result, VK_SUCCESS); EXPECT_STREQ(extensions[0].extensionName, "VK_KHR_driver_properties"); EXPECT_STREQ(extensions[1].extensionName, "VK_KHR_get_memory_requirements2"); // Check behavior for unknown block - result = vpGetProfileDeviceExtensionProperties(&profile, "pouet", &extensions_count, nullptr); + result = vpGetProfileDeviceExtensionProperties(mock.functions, &profile, "pouet", &extensions_count, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(extensions_count, 0); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); EXPECT_EQ(features.features.depthBiasClamp, VK_TRUE); EXPECT_EQ(features.features.depthClamp, VK_TRUE); @@ -606,7 +610,7 @@ TEST(mocked_api_generated_library, check_support_variants_instance_extensions_re VkResult result = VK_SUCCESS; uint32_t extensions_count = 0; - result = vpGetProfileInstanceExtensionProperties(&profile, "block", &extensions_count, nullptr); + result = vpGetProfileInstanceExtensionProperties(mock.functions, &profile, "block", &extensions_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(extensions_count, 0); } @@ -619,12 +623,12 @@ TEST(mocked_api_generated_library, check_support_variants_device_extensions_refl VkResult result = VK_SUCCESS; uint32_t extensions_count = 0; - result = vpGetProfileDeviceExtensionProperties(&profile, "block", &extensions_count, nullptr); + result = vpGetProfileDeviceExtensionProperties(mock.functions, &profile, "block", &extensions_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(extensions_count, 1); std::vector extensions(extensions_count); - result = vpGetProfileDeviceExtensionProperties(&profile, "block", &extensions_count, &extensions[0]); + result = vpGetProfileDeviceExtensionProperties(mock.functions, &profile, "block", &extensions_count, &extensions[0]); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(extensions_count, 1); @@ -637,7 +641,7 @@ TEST(mocked_api_generated_library, check_support_variants_feature_reflection) { const VpProfileProperties profile{VP_LUNARG_TEST_VARIANTS_NAME, VP_LUNARG_TEST_VARIANTS_SPEC_VERSION}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - VkResult result = vpGetProfileFeatures(&profile, "block", &features); + VkResult result = vpGetProfileFeatures(mock.functions, &profile, "block", &features); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(features.features.depthBiasClamp, VK_TRUE); @@ -654,10 +658,10 @@ TEST(mocked_api_generated_library, check_support_variants_property_reflection) { VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; const VpProfileProperties profileUnknown{"pouet", 1}; - VkResult result = vpGetProfileProperties(&profileUnknown, nullptr, &props); + VkResult result = vpGetProfileProperties(mock.functions, &profileUnknown, nullptr, &props); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileProperties(&profile, nullptr, &props); + result = vpGetProfileProperties(mock.functions, &profile, nullptr, &props); EXPECT_EQ(result, VK_ERROR_UNKNOWN); EXPECT_EQ(props.properties.limits.maxImageArrayLayers, 0); @@ -666,7 +670,7 @@ TEST(mocked_api_generated_library, check_support_variants_property_reflection) { EXPECT_EQ(props.properties.limits.maxImageDimension3D, 0); EXPECT_EQ(props.properties.limits.maxImageDimensionCube, 0); - result = vpGetProfileProperties(&profile, "block", &props); + result = vpGetProfileProperties(mock.functions, &profile, "block", &props); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(props.properties.limits.maxImageArrayLayers, 0); @@ -675,7 +679,7 @@ TEST(mocked_api_generated_library, check_support_variants_property_reflection) { EXPECT_EQ(props.properties.limits.maxImageDimension3D, 2048); EXPECT_EQ(props.properties.limits.maxImageDimensionCube, 0); - result = vpGetProfileProperties(&profile, "variant_a", &props); + result = vpGetProfileProperties(mock.functions, &profile, "variant_a", &props); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(props.properties.limits.maxImageArrayLayers, 0); @@ -684,7 +688,7 @@ TEST(mocked_api_generated_library, check_support_variants_property_reflection) { EXPECT_EQ(props.properties.limits.maxImageDimension3D, 2048); EXPECT_EQ(props.properties.limits.maxImageDimensionCube, 0); - result = vpGetProfileProperties(&profile, "variant_b", &props); + result = vpGetProfileProperties(mock.functions, &profile, "variant_b", &props); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(props.properties.limits.maxImageArrayLayers, 0); @@ -693,11 +697,13 @@ TEST(mocked_api_generated_library, check_support_variants_property_reflection) { EXPECT_EQ(props.properties.limits.maxImageDimension3D, 4096); EXPECT_EQ(props.properties.limits.maxImageDimensionCube, 4096); - result = vpGetProfileProperties(&profile, "variant_unknown", &props); + result = vpGetProfileProperties(mock.functions, &profile, "variant_unknown", &props); EXPECT_EQ(result, VK_INCOMPLETE); } TEST(mocked_api_generated_library, check_support_variants_queue_family_reflection) { + MockVulkanAPI mock; + const VpProfileProperties profile{VP_LUNARG_TEST_VARIANTS_NAME, VP_LUNARG_TEST_VARIANTS_SPEC_VERSION}; VkResult result = VK_SUCCESS; @@ -705,15 +711,15 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_reflectio std::vector props{}; const VpProfileProperties profileUnknown{"pouet", 1}; - result = vpGetProfileQueueFamilyProperties(&profileUnknown, nullptr, &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profileUnknown, nullptr, &queue_family_count, nullptr); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 4); props.resize(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); - result = vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, props.data()); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 4); @@ -729,7 +735,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_reflectio queue_family_count = 2; props.clear(); props.resize(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); - result = vpGetProfileQueueFamilyProperties(&profile, nullptr, &queue_family_count, props.data()); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, nullptr, &queue_family_count, props.data()); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(queue_family_count, 2); @@ -738,39 +744,39 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_reflectio EXPECT_EQ(props[1].queueFamilyProperties.queueFlags, VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT); EXPECT_EQ(props[1].queueFamilyProperties.queueCount, 2); - result = vpGetProfileQueueFamilyProperties(&profile, "block", &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "block", &queue_family_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 1); props.clear(); props.resize(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); - result = vpGetProfileQueueFamilyProperties(&profile, "block", &queue_family_count, props.data()); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "block", &queue_family_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 1); EXPECT_EQ(props[0].queueFamilyProperties.queueFlags, VK_QUEUE_TRANSFER_BIT); EXPECT_EQ(props[0].queueFamilyProperties.queueCount, 2); - result = vpGetProfileQueueFamilyProperties(&profile, "variant_a", &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "variant_a", &queue_family_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 1); props.clear(); props.resize(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); - result = vpGetProfileQueueFamilyProperties(&profile, "variant_a", &queue_family_count, props.data()); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "variant_a", &queue_family_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 1); EXPECT_EQ(props[0].queueFamilyProperties.queueFlags, VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT); EXPECT_EQ(props[0].queueFamilyProperties.queueCount, 2); - result = vpGetProfileQueueFamilyProperties(&profile, "variant_b", &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "variant_b", &queue_family_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 2); props.clear(); props.resize(queue_family_count, {VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, nullptr}); - result = vpGetProfileQueueFamilyProperties(&profile, "variant_b", &queue_family_count, props.data()); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "variant_b", &queue_family_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(queue_family_count, 2); @@ -779,22 +785,22 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_reflectio EXPECT_EQ(props[1].queueFamilyProperties.queueFlags, VK_QUEUE_PROTECTED_BIT); EXPECT_EQ(props[1].queueFamilyProperties.queueCount, 1); - result = vpGetProfileQueueFamilyProperties(&profile, "variant_unknown", &queue_family_count, nullptr); + result = vpGetProfileQueueFamilyProperties(mock.functions, &profile, "variant_unknown", &queue_family_count, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); const VpProfileProperties profile2{VP_RASTERGRID_TEST_VIDEO_PROFILES_NAME, VP_RASTERGRID_TEST_VIDEO_PROFILES_SPEC_VERSION}; uint32_t structure_type_count = 0; - result = vpGetProfileQueueFamilyStructureTypes(&profile2, "pouet", &structure_type_count, nullptr); + result = vpGetProfileQueueFamilyStructureTypes(mock.functions, &profile2, "pouet", &structure_type_count, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(structure_type_count, 0); - result = vpGetProfileQueueFamilyStructureTypes(&profile2, nullptr, &structure_type_count, nullptr); + result = vpGetProfileQueueFamilyStructureTypes(mock.functions, &profile2, nullptr, &structure_type_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); std::vector structure_types(structure_type_count); - result = vpGetProfileQueueFamilyStructureTypes(&profile2, nullptr, &structure_type_count, structure_types.data()); + result = vpGetProfileQueueFamilyStructureTypes(mock.functions, &profile2, nullptr, &structure_type_count, structure_types.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); EXPECT_EQ(structure_types[0], VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR); @@ -808,26 +814,26 @@ TEST(mocked_api_generated_library, check_support_variants_format_reflection) { const VpProfileProperties profile{VP_LUNARG_TEST_VARIANTS_NAME, VP_LUNARG_TEST_VARIANTS_SPEC_VERSION}; uint32_t formatCount = 0; - result = vpGetProfileFormats(&profile, "pouet", &formatCount, nullptr); + result = vpGetProfileFormats(mock.functions, &profile, "pouet", &formatCount, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(formatCount, 0); - result = vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + result = vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(formatCount, 1); std::vector formats(formatCount); - result = vpGetProfileFormats(&profile, nullptr, &formatCount, &formats[0]); + result = vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, &formats[0]); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(formatCount, 1); EXPECT_EQ(formats[0], VK_FORMAT_R8G8B8A8_UNORM); VkFormatProperties3KHR properties3{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR}; VkFormatProperties2KHR properties2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR, &properties3}; - result = vpGetProfileFormatProperties(&profile, "pouet", VK_FORMAT_R8G8B8A8_UNORM, &properties2); + result = vpGetProfileFormatProperties(mock.functions, &profile, "pouet", VK_FORMAT_R8G8B8A8_UNORM, &properties2); EXPECT_EQ(result, VK_INCOMPLETE); - result = vpGetProfileFormatProperties(&profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &properties2); + result = vpGetProfileFormatProperties(mock.functions, &profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &properties2); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(properties2.formatProperties.bufferFeatures, 0); EXPECT_EQ(properties2.formatProperties.optimalTilingFeatures, 0); @@ -840,7 +846,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_reflection) { properties2.formatProperties.linearTilingFeatures = 0; properties3.linearTilingFeatures = 0; - result = vpGetProfileFormatProperties(&profile, "block", VK_FORMAT_R8G8B8A8_UNORM, &properties2); + result = vpGetProfileFormatProperties(mock.functions, &profile, "block", VK_FORMAT_R8G8B8A8_UNORM, &properties2); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(properties2.formatProperties.bufferFeatures, 0); EXPECT_EQ(properties2.formatProperties.optimalTilingFeatures, 0); @@ -851,7 +857,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_reflection) { properties2.formatProperties.linearTilingFeatures = 0; properties3.linearTilingFeatures = 0; - result = vpGetProfileFormatProperties(&profile, "variant_b", VK_FORMAT_R8G8B8A8_UNORM, &properties2); + result = vpGetProfileFormatProperties(mock.functions, &profile, "variant_b", VK_FORMAT_R8G8B8A8_UNORM, &properties2); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(properties2.formatProperties.bufferFeatures, 0); EXPECT_EQ(properties2.formatProperties.optimalTilingFeatures, 0); @@ -861,16 +867,16 @@ TEST(mocked_api_generated_library, check_support_variants_format_reflection) { EXPECT_EQ(properties3.linearTilingFeatures, VK_FORMAT_FEATURE_BLIT_DST_BIT); uint32_t structureTypeCount = 0; - result = vpGetProfileFormatStructureTypes(&profile, "pouet", &structureTypeCount, nullptr); + result = vpGetProfileFormatStructureTypes(mock.functions, &profile, "pouet", &structureTypeCount, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(structureTypeCount, 0); - result = vpGetProfileFormatStructureTypes(&profile, nullptr, &structureTypeCount, nullptr); + result = vpGetProfileFormatStructureTypes(mock.functions, &profile, nullptr, &structureTypeCount, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structureTypeCount, 2); std::vector structureTypes(structureTypeCount); - result = vpGetProfileFormatStructureTypes(&profile, nullptr, &structureTypeCount, &structureTypes[0]); + result = vpGetProfileFormatStructureTypes(mock.functions, &profile, nullptr, &structureTypeCount, &structureTypes[0]); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structureTypeCount, 2); EXPECT_EQ(structureTypes[0], VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2); @@ -885,7 +891,7 @@ TEST(mocked_api_generated_library, check_support_variants_success_2variants) { fixProperties(mock); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -893,7 +899,7 @@ TEST(mocked_api_generated_library, check_support_variants_success_2variants) { std::vector block_properties(10); uint32_t block_property_count = static_cast(block_properties.size()); - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -915,9 +921,9 @@ TEST(mocked_api_generated_library, check_support_variants_extensions_success_1va mock.ClearProfileAreas(PROFILE_AREA_EXTENSIONS_BIT); uint32_t extensions_count = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, nullptr); std::vector extensions(extensions_count); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensions_count, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensions_count, &extensions[0]); // To discard "variant_a" variant support extensions.resize(1); @@ -926,7 +932,7 @@ TEST(mocked_api_generated_library, check_support_variants_extensions_success_1va } VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -934,7 +940,7 @@ TEST(mocked_api_generated_library, check_support_variants_extensions_success_1va std::vector block_properties(10); uint32_t block_property_count = static_cast(block_properties.size()); - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -962,7 +968,7 @@ TEST(mocked_api_generated_library, check_support_variants_extensions_fail) { } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -970,7 +976,7 @@ TEST(mocked_api_generated_library, check_support_variants_extensions_fail) { std::vector block_properties(10); uint32_t block_property_count = static_cast(block_properties.size()); - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -994,7 +1000,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_success_1vari mock.ClearProfileAreas(PROFILE_AREA_FEATURES_BIT); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.drawIndirectFirstInstance = false; @@ -1002,7 +1008,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_success_1vari } VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1011,7 +1017,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_success_1vari uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(supported, VK_TRUE); @@ -1034,7 +1040,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_fail) { mock.ClearProfileAreas(PROFILE_AREA_FEATURES_BIT); VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.drawIndirectFirstInstance = false; features.features.fullDrawIndexUint32 = false; @@ -1043,7 +1049,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_fail) { } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1052,7 +1058,7 @@ TEST(mocked_api_generated_library, check_support_variants_features_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_TRUE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1071,7 +1077,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_success_1va mock.ClearProfileAreas(PROFILE_AREA_PROPERTIES_BIT); VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension1D = 8192; props.properties.limits.maxImageDimension2D = 8192; props.properties.limits.maxImageDimension3D = 4096; @@ -1084,7 +1090,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_success_1va } VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1093,7 +1099,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_success_1va uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(supported, VK_TRUE); @@ -1114,7 +1120,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_fail) { mock.ClearProfileAreas(PROFILE_AREA_PROPERTIES_BIT); VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension1D = 8192; props.properties.limits.maxImageDimension2D = 8192; props.properties.limits.maxImageDimension3D = 4096; @@ -1128,7 +1134,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_fail) { } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1137,7 +1143,7 @@ TEST(mocked_api_generated_library, check_support_variants_properties_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_TRUE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1166,7 +1172,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_success_2 mock.AddQueueFamily({VK_STRUCT(props)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1175,7 +1181,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_success_2 uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(supported, VK_TRUE); @@ -1206,7 +1212,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_success_1 mock.AddQueueFamily({VK_STRUCT(props)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1215,7 +1221,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_success_1 uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(supported, VK_TRUE); @@ -1246,7 +1252,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_fail) { mock.AddQueueFamily({VK_STRUCT(props)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1255,7 +1261,7 @@ TEST(mocked_api_generated_library, check_support_variants_queue_family_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_TRUE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1278,7 +1284,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_success_1varian mock.ClearProfileAreas(PROFILE_AREA_FORMATS_BIT); VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &formatProps); formatProps.formatProperties.linearTilingFeatures = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; @@ -1286,7 +1292,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_success_1varian } VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1295,7 +1301,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_success_1varian uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(supported, VK_TRUE); @@ -1318,7 +1324,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_fail) { mock.ClearProfileAreas(PROFILE_AREA_FORMATS_BIT); VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, VK_FORMAT_R8G8B8A8_UNORM, &formatProps); formatProps.formatProperties.linearTilingFeatures = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT; @@ -1326,7 +1332,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_fail) { } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1335,7 +1341,7 @@ TEST(mocked_api_generated_library, check_support_variants_format_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_TRUE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1346,6 +1352,8 @@ TEST(mocked_api_generated_library, check_support_variants_format_fail) { } TEST(mocked_api_generated_library, check_support_variants_video_profile_reflection) { + MockVulkanAPI mock; + const VpProfileProperties profile{VP_RASTERGRID_TEST_VIDEO_PROFILES_NAME, VP_RASTERGRID_TEST_VIDEO_PROFILES_SPEC_VERSION}; VkResult result = VK_SUCCESS; @@ -1353,15 +1361,15 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_reflecti std::vector props{}; const VpProfileProperties profileUnknown{"pouet", 1}; - result = vpGetProfileVideoProfiles(&profileUnknown, nullptr, &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profileUnknown, nullptr, &video_profile_count, nullptr); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileVideoProfiles(&profile, nullptr, &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profile, nullptr, &video_profile_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 3); props.resize(video_profile_count); - result = vpGetProfileVideoProfiles(&profile, nullptr, &video_profile_count, props.data()); + result = vpGetProfileVideoProfiles(mock.functions, &profile, nullptr, &video_profile_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 3); @@ -1373,47 +1381,49 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_reflecti props.clear(); props.resize(video_profile_count); - result = vpGetProfileVideoProfiles(&profile, nullptr, &video_profile_count, props.data()); + result = vpGetProfileVideoProfiles(mock.functions, &profile, nullptr, &video_profile_count, props.data()); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(video_profile_count, 2); EXPECT_STREQ(props[0].name, "H.264 Decode (4:2:0 8-bit) Main progressive"); EXPECT_STREQ(props[1].name, "H.265 Decode (4:2:0 8-bit) Main"); - result = vpGetProfileVideoProfiles(&profile, "block", &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "block", &video_profile_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 0); - result = vpGetProfileVideoProfiles(&profile, "variant_h264", &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "variant_h264", &video_profile_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 1); props.clear(); props.resize(video_profile_count); - result = vpGetProfileVideoProfiles(&profile, "variant_h264", &video_profile_count, props.data()); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "variant_h264", &video_profile_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 1); EXPECT_STREQ(props[0].name, "H.264 Decode (4:2:0 8-bit) Main progressive"); - result = vpGetProfileVideoProfiles(&profile, "variant_h265", &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "variant_h265", &video_profile_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 2); props.clear(); props.resize(video_profile_count); - result = vpGetProfileVideoProfiles(&profile, "variant_h265", &video_profile_count, props.data()); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "variant_h265", &video_profile_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_profile_count, 2); EXPECT_STREQ(props[0].name, "H.265 Decode (4:2:0 8-bit) Main"); EXPECT_STREQ(props[1].name, "H.265 Decode (4:2:0 10-bit) Main 10"); - result = vpGetProfileVideoProfiles(&profile, "variant_unknown", &video_profile_count, nullptr); + result = vpGetProfileVideoProfiles(mock.functions, &profile, "variant_unknown", &video_profile_count, nullptr); EXPECT_EQ(result, VK_INCOMPLETE); } TEST(mocked_api_generated_library, check_support_variants_video_profile_info_reflection) { + MockVulkanAPI mock; + const VpProfileProperties profile{VP_RASTERGRID_TEST_VIDEO_PROFILES_NAME, VP_RASTERGRID_TEST_VIDEO_PROFILES_SPEC_VERSION}; VkResult result = VK_SUCCESS; @@ -1441,21 +1451,21 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_info_ref }; clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, nullptr, 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, nullptr, 0, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "block", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "block", 0, &profile_info); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h264", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h264", 0, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h265", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h265", 0, &profile_info); EXPECT_EQ(result, VK_SUCCESS); EXPECT_NE(profile_info.videoCodecOperation, VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR); @@ -1470,21 +1480,21 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_info_ref }; clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, nullptr, 1, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, nullptr, 1, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "block", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "block", 0, &profile_info); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h264", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h264", 0, &profile_info); EXPECT_EQ(result, VK_SUCCESS); EXPECT_NE(profile_info.videoCodecOperation, VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h265", 0, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h265", 0, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); @@ -1499,20 +1509,20 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_info_ref }; clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, nullptr, 2, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, nullptr, 2, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "block", 2, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "block", 2, &profile_info); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h264", 1, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h264", 1, &profile_info); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoProfileInfo(&profile, "variant_h265", 1, &profile_info); + result = vpGetProfileVideoProfileInfo(mock.functions, &profile, "variant_h265", 1, &profile_info); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); @@ -1522,13 +1532,13 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_info_ref std::vector structure_types{}; for (uint32_t i = 0; i < 3; ++i) { - result = vpGetProfileVideoProfileInfoStructureTypes(&profile, nullptr, i, &structure_type_count, nullptr); + result = vpGetProfileVideoProfileInfoStructureTypes(mock.functions, &profile, nullptr, i, &structure_type_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); structure_types.clear(); structure_types.resize(structure_type_count); - result = vpGetProfileVideoProfileInfoStructureTypes(&profile, nullptr, i, &structure_type_count, structure_types.data()); + result = vpGetProfileVideoProfileInfoStructureTypes(mock.functions, &profile, nullptr, i, &structure_type_count, structure_types.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); @@ -1542,6 +1552,8 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_info_ref } TEST(mocked_api_generated_library, check_support_variants_video_capability_reflection) { + MockVulkanAPI mock; + const VpProfileProperties profile{VP_RASTERGRID_TEST_VIDEO_PROFILES_NAME, VP_RASTERGRID_TEST_VIDEO_PROFILES_SPEC_VERSION}; VkResult result = VK_SUCCESS; @@ -1567,21 +1579,21 @@ TEST(mocked_api_generated_library, check_support_variants_video_capability_refle }; clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, nullptr, 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, nullptr, 0, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "block", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "block", 0, &caps); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h264", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h264", 0, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h265", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h265", 0, &caps); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(caps_h264.maxLevelIdc, 0); @@ -1596,21 +1608,21 @@ TEST(mocked_api_generated_library, check_support_variants_video_capability_refle }; clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, nullptr, 1, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, nullptr, 1, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "block", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "block", 0, &caps); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h264", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h264", 0, &caps); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(caps_h265.maxLevelIdc, 0); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h265", 0, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h265", 0, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); @@ -1625,20 +1637,20 @@ TEST(mocked_api_generated_library, check_support_variants_video_capability_refle }; clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, nullptr, 2, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, nullptr, 2, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "block", 2, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "block", 2, &caps); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h264", 1, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h264", 1, &caps); EXPECT_EQ(result, VK_ERROR_UNKNOWN); clear_chain(); - result = vpGetProfileVideoCapabilities(&profile, "variant_h265", 1, &caps); + result = vpGetProfileVideoCapabilities(mock.functions, &profile, "variant_h265", 1, &caps); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); @@ -1648,13 +1660,13 @@ TEST(mocked_api_generated_library, check_support_variants_video_capability_refle std::vector structure_types{}; for (uint32_t i = 0; i < 3; ++i) { - result = vpGetProfileVideoCapabilityStructureTypes(&profile, nullptr, i, &structure_type_count, nullptr); + result = vpGetProfileVideoCapabilityStructureTypes(mock.functions, &profile, nullptr, i, &structure_type_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); structure_types.clear(); structure_types.resize(structure_type_count); - result = vpGetProfileVideoCapabilityStructureTypes(&profile, nullptr, i, &structure_type_count, structure_types.data()); + result = vpGetProfileVideoCapabilityStructureTypes(mock.functions, &profile, nullptr, i, &structure_type_count, structure_types.data()); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(structure_type_count, 2); @@ -1668,6 +1680,8 @@ TEST(mocked_api_generated_library, check_support_variants_video_capability_refle } TEST(mocked_api_generated_library, check_support_variants_video_format_reflection) { + MockVulkanAPI mock; + const VpProfileProperties profile{VP_RASTERGRID_TEST_VIDEO_PROFILES_NAME, VP_RASTERGRID_TEST_VIDEO_PROFILES_SPEC_VERSION}; VkResult result = VK_SUCCESS; @@ -1692,28 +1706,28 @@ TEST(mocked_api_generated_library, check_support_variants_video_format_reflectio EXPECT_EQ(props[1].imageUsageFlags, VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR); }; - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 0, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 0, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 2); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 0, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 0, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "block", 0, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "block", 0, &video_format_count, props.data()); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h264", 0, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h264", 0, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 2); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h264", 0, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h264", 0, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h264_main(); @@ -1734,28 +1748,28 @@ TEST(mocked_api_generated_library, check_support_variants_video_format_reflectio EXPECT_EQ(props[1].imageUsageFlags, VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); }; - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 1, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 1, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 2); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 1, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 1, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "block", 1, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "block", 1, &video_format_count, props.data()); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h265", 0, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h265", 0, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 2); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h265", 0, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h265", 0, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h265_main(); @@ -1771,28 +1785,28 @@ TEST(mocked_api_generated_library, check_support_variants_video_format_reflectio VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); }; - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 2, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 2, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 1); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 2, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 2, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "block", 2, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "block", 2, &video_format_count, props.data()); EXPECT_EQ(result, VK_ERROR_UNKNOWN); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h265", 0, &video_format_count, nullptr); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h265", 0, &video_format_count, nullptr); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(video_format_count, 2); props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, "variant_h265", 1, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, "variant_h265", 1, &video_format_count, props.data()); EXPECT_EQ(result, VK_SUCCESS); check_h265_main_10(); @@ -1801,7 +1815,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_format_reflectio video_format_count = 1; props.clear(); props.resize(video_format_count, {VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR, nullptr}); - result = vpGetProfileVideoFormatProperties(&profile, nullptr, 0, &video_format_count, props.data()); + result = vpGetProfileVideoFormatProperties(mock.functions, &profile, nullptr, 0, &video_format_count, props.data()); EXPECT_EQ(result, VK_INCOMPLETE); EXPECT_EQ(props[0].format, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM); @@ -1819,7 +1833,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ initProfile(mock, profile); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1828,7 +1842,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1859,7 +1873,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ mock.RemoveVideoCapabilities(profile_info); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1868,7 +1882,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1886,7 +1900,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ mock.RemoveVideoFormats(profile_info); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1895,7 +1909,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_success_ uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1918,7 +1932,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_fail) { mock.ClearProfileAreas(PROFILE_AREA_VIDEO_CAPABILITIES_BIT); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1927,7 +1941,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1945,7 +1959,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_fail) { mock.ClearProfileAreas(PROFILE_AREA_VIDEO_FORMATS_BIT); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1954,7 +1968,7 @@ TEST(mocked_api_generated_library, check_support_variants_video_profile_fail) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -1990,7 +2004,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { // No video profiles at all { VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -1999,7 +2013,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -2046,7 +2060,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { mock.AddVideoFormat(h264_decode_profile, {VK_STRUCT(dpb_format)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -2055,7 +2069,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -2078,7 +2092,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { mock.AddVideoFormat(h264_decode_profile, {VK_STRUCT(dst_format)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -2087,7 +2101,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -2109,7 +2123,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { mock.AddVideoFormat(h264_decode_profile, {VK_STRUCT(dst_format)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -2134,7 +2148,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { mock.AddVideoCapabilities(h264_decode_profile, {VK_STRUCT(caps), VK_STRUCT(decode_caps), VK_STRUCT(h264_decode_caps)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -2143,7 +2157,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); @@ -2172,7 +2186,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { mock.AddVideoCapabilities(h264_decode_profile, {VK_STRUCT(caps), VK_STRUCT(decode_caps), VK_STRUCT(h264_decode_caps)}); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -2181,7 +2195,7 @@ TEST(mocked_api_generated_library, check_support_wildcard_video_profiles) { uint32_t block_property_count = static_cast(block_properties.size()); supported = VK_FALSE; - result = vpGetPhysicalDeviceProfileVariantsSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, + result = vpGetPhysicalDeviceProfileVariantsSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported, &block_property_count, &block_properties[0]); EXPECT_EQ(result, VK_SUCCESS); diff --git a/library/test/test_mocked_api_get_instance_profile_support.cpp b/library/test/test_mocked_api_get_instance_profile_support.cpp index 85ff2c4c..b857592c 100644 --- a/library/test/test_mocked_api_get_instance_profile_support.cpp +++ b/library/test/test_mocked_api_get_instance_profile_support.cpp @@ -19,16 +19,23 @@ * - Daniel Rakos */ -#include "mock_vulkan_api.hpp" -#include "mock_debug_message_callback.hpp" +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + +#include #include +#include "mock_debug_message_callback.hpp" + #ifdef WITH_DEBUG_MESSAGES #include "generated_vulkan_profiles_debug.hpp" #else #include "generated_vulkan_profiles.hpp" #endif +#include "mock_vulkan_api.hpp" + TEST(mocked_api_get_instance_profile_support, vulkan10_supported) { MockVulkanAPI mock; @@ -50,7 +57,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan10_supported) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_FALSE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -83,7 +90,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan10_no_gpdp2) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -112,7 +119,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan10_unsupported_version) { const VpProfileProperties profile = {VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION}; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -142,7 +149,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan10_unsupported_extension) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -169,7 +176,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan11_supported) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_FALSE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -198,7 +205,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan11_unsupported_version) { VpProfileProperties profile{ VP_KHR_ROADMAP_2022_NAME, VP_KHR_ROADMAP_2022_SPEC_VERSION }; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -230,7 +237,7 @@ TEST(mocked_api_get_instance_profile_support, vulkan11_unsupported_extension) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport(nullptr, &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, nullptr, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -257,7 +264,7 @@ TEST(mocked_api_get_instance_profile_support, layer_supported) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_FALSE; - VkResult result = vpGetInstanceProfileSupport("VK_DUMMY_layer1", &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, "VK_DUMMY_layer1", &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -299,7 +306,7 @@ TEST(mocked_api_get_instance_profile_support, layer_unsupported) { VpProfileProperties profile{ VP_ANDROID_BASELINE_2021_NAME, VP_ANDROID_BASELINE_2021_SPEC_VERSION }; VkBool32 supported = VK_TRUE; - VkResult result = vpGetInstanceProfileSupport("VK_DUMMY_layer2", &profile, &supported); + VkResult result = vpGetInstanceProfileSupport(mock.functions, "VK_DUMMY_layer2", &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); diff --git a/library/test/test_mocked_api_get_physdev_profile_support.cpp b/library/test/test_mocked_api_get_physdev_profile_support.cpp index b2fca540..9ad7c24e 100644 --- a/library/test/test_mocked_api_get_physdev_profile_support.cpp +++ b/library/test/test_mocked_api_get_physdev_profile_support.cpp @@ -19,16 +19,23 @@ * - Daniel Rakos */ -#include "mock_vulkan_api.hpp" -#include "mock_debug_message_callback.hpp" +#ifndef VP_USE_OBJECT +#define VP_USE_OBJECT 1 +#endif + +#include #include +#include "mock_debug_message_callback.hpp" + #ifdef WITH_DEBUG_MESSAGES #include "generated_vulkan_profiles_debug.hpp" #else #include "generated_vulkan_profiles.hpp" #endif +#include "mock_vulkan_api.hpp" + TEST(mocked_api_get_physdev_profile_support, vulkan10_supported) { MockVulkanAPI mock; @@ -64,7 +71,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_supported) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.dualSrcBlend = VK_TRUE; features.features.drawIndirectFirstInstance = VK_TRUE; multiviewFeatures.multiview = VK_TRUE; @@ -75,7 +82,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_supported) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension2D = 16384; props.properties.limits.maxBoundDescriptorSets = 8; props.properties.limits.subPixelPrecisionBits = 8; @@ -94,12 +101,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_supported) { }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -113,13 +120,14 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_supported) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_FALSE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); } -TEST(mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { +// Vulkan 1.1 is required +TEST(DISABLED_mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { MockVulkanAPI mock; // We don't set an instance version which will also result in no GPDP2 entry points @@ -149,7 +157,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.dualSrcBlend = VK_TRUE; features.features.drawIndirectFirstInstance = VK_TRUE; multiviewFeatures.multiview = VK_TRUE; @@ -160,7 +168,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension2D = 16384; props.properties.limits.maxBoundDescriptorSets = 8; props.properties.limits.subPixelPrecisionBits = 8; @@ -179,12 +187,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -198,7 +206,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_no_gpdp2) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_ERROR_EXTENSION_NOT_PRESENT); EXPECT_EQ(supported, VK_TRUE); @@ -228,7 +236,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_version) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({ VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features), VK_STRUCT(vulkanGlobalPriorityFeatures) @@ -238,19 +246,19 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_version) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties( {VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties) }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -276,7 +284,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_version) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -318,7 +326,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_extension) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.dualSrcBlend = VK_TRUE; features.features.drawIndirectFirstInstance = VK_TRUE; multiviewFeatures.multiview = VK_TRUE; @@ -329,7 +337,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_extension) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension2D = 16384; props.properties.limits.maxBoundDescriptorSets = 8; props.properties.limits.subPixelPrecisionBits = 8; @@ -348,12 +356,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_extension) { }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -367,7 +375,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_extension) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -409,7 +417,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_feature) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.sampleRateShading = VK_FALSE; // Unsupported feature features.features.dualSrcBlend = VK_TRUE; features.features.drawIndirectFirstInstance = VK_TRUE; @@ -421,7 +429,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_feature) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension2D = 16384; props.properties.limits.maxBoundDescriptorSets = 8; props.properties.limits.subPixelPrecisionBits = 8; @@ -440,12 +448,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_feature) { }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -459,7 +467,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_feature) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -501,7 +509,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_property) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.dualSrcBlend = VK_TRUE; features.features.drawIndirectFirstInstance = VK_TRUE; multiviewFeatures.multiview = VK_TRUE; @@ -512,7 +520,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_property) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimension2D = 2048; // Unsupported property props.properties.limits.maxBoundDescriptorSets = 8; props.properties.limits.subPixelPrecisionBits = 8; @@ -531,12 +539,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_property) { }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; mock.AddFormat(formats[i], { VK_STRUCT(formatProps) }); @@ -550,7 +558,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_property) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -598,7 +606,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_format) { VkPhysicalDeviceMultiviewFeaturesKHR multiviewFeatures{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR }; VkPhysicalDeviceFeatures2KHR features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, &multiviewFeatures }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({ VK_STRUCT(features), VK_STRUCT(multiviewFeatures) @@ -606,19 +614,19 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_format) { VkPhysicalDeviceMultiviewPropertiesKHR multiviewProps{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR }; VkPhysicalDeviceProperties2KHR props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR, &multiviewProps }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties({ VK_STRUCT(props), VK_STRUCT(multiviewProps) }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); formatProps.formatProperties.optimalTilingFeatures |= VK_FORMAT_FEATURE_BLIT_SRC_BIT; formatProps.formatProperties.bufferFeatures |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; if (formats[i] == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) { @@ -635,7 +643,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan10_unsupported_format) { mock.AddQueueFamily({ VK_STRUCT(queueFamilyProps) }); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -664,7 +672,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan11_unsupported_version) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features), VK_STRUCT(vulkanGlobalPriorityFeatures)}); @@ -672,18 +680,18 @@ TEST(mocked_api_get_physdev_profile_support, vulkan11_unsupported_version) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties( {VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); mock.AddFormat(formats[i], {VK_STRUCT(formatProps)}); } @@ -708,7 +716,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan11_unsupported_version) { mock.AddQueueFamily({VK_STRUCT(queueFamilyProps)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -736,7 +744,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_extension) { VkPhysicalDeviceVulkan12Features vulkan12Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &vulkan13Features}; VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkan11Features}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features)}); @@ -744,12 +752,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_extension) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties({VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -778,7 +786,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_feature) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); features.features.fullDrawIndexUint32 = VK_FALSE; @@ -788,12 +796,12 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_feature) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties({VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -822,7 +830,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_property) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features), VK_STRUCT(vulkanGlobalPriorityFeatures)}); @@ -830,7 +838,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_property) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); props.properties.limits.maxImageDimensionCube = 2048; @@ -838,7 +846,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_unsupported_property) { {VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -865,31 +873,31 @@ TEST(mocked_api_get_physdev_profile_support, vulkan11_unsupported_format) { mock.SetDeviceAPIVersion(VK_API_VERSION_1_1); uint32_t extensionsCount = 0; - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensionsCount, nullptr); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensionsCount, nullptr); std::vector extensions(extensionsCount); - vpGetProfileDeviceExtensionProperties(&profile, nullptr, &extensionsCount, &extensions[0]); + vpGetProfileDeviceExtensionProperties(mock.functions, &profile, nullptr, &extensionsCount, &extensions[0]); mock.SetDeviceExtensions(mock.vkPhysicalDevice, extensions); VkPhysicalDeviceFeatures2 features{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 }; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({ VK_STRUCT(features), }); VkPhysicalDeviceProperties2 props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 }; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties({ VK_STRUCT(props), }); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR }; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); if (formats[i] == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) { formatProps.formatProperties.optimalTilingFeatures = 0; // Unsupported format } @@ -897,7 +905,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan11_unsupported_format) { } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_FALSE); @@ -927,7 +935,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_supported_queue_family) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features), VK_STRUCT(vulkanGlobalPriorityFeatures)}); @@ -935,18 +943,18 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_supported_queue_family) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties( {VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); mock.AddFormat(formats[i], {VK_STRUCT(formatProps)}); } @@ -971,7 +979,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_supported_queue_family) { mock.AddQueueFamily({VK_STRUCT(queueFamilyProps)}); VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); @@ -1000,7 +1008,7 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_supported_version) { VkPhysicalDeviceVulkan11Features vulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &vulkan12Features}; VkPhysicalDeviceGlobalPriorityQueryFeatures vulkanGlobalPriorityFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES, &vulkan11Features}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &vulkanGlobalPriorityFeatures}; - vpGetProfileFeatures(&profile, nullptr, &features); + vpGetProfileFeatures(mock.functions, &profile, nullptr, &features); mock.SetFeatures({VK_STRUCT(features), VK_STRUCT(vulkan11Features), VK_STRUCT(vulkan12Features), VK_STRUCT(vulkan13Features), VK_STRUCT(vulkanGlobalPriorityFeatures)}); @@ -1008,23 +1016,23 @@ TEST(mocked_api_get_physdev_profile_support, vulkan13_supported_version) { VkPhysicalDeviceVulkan12Properties vulkan12Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties}; VkPhysicalDeviceVulkan11Properties vulkan11Properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties}; VkPhysicalDeviceProperties2 props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &vulkan11Properties}; - vpGetProfileProperties(&profile, nullptr, &props); + vpGetProfileProperties(mock.functions, &profile, nullptr, &props); mock.SetProperties( {VK_STRUCT(props), VK_STRUCT(vulkan11Properties), VK_STRUCT(vulkan12Properties), VK_STRUCT(vulkan13Properties)}); uint32_t formatCount; - vpGetProfileFormats(&profile, nullptr, &formatCount, nullptr); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, nullptr); std::vector formats(formatCount); - vpGetProfileFormats(&profile, nullptr, &formatCount, formats.data()); + vpGetProfileFormats(mock.functions, &profile, nullptr, &formatCount, formats.data()); for (size_t i = 0; i < formatCount; ++i) { VkFormatProperties2KHR formatProps{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR}; - vpGetProfileFormatProperties(&profile, nullptr, formats[i], &formatProps); + vpGetProfileFormatProperties(mock.functions, &profile, nullptr, formats[i], &formatProps); mock.AddFormat(formats[i], {VK_STRUCT(formatProps)}); } VkBool32 supported = VK_TRUE; - VkResult result = vpGetPhysicalDeviceProfileSupport(mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); + VkResult result = vpGetPhysicalDeviceProfileSupport(mock.functions, mock.vkInstance, mock.vkPhysicalDevice, &profile, &supported); EXPECT_EQ(result, VK_SUCCESS); EXPECT_EQ(supported, VK_TRUE); diff --git a/scripts/gen_profiles_solution.py b/scripts/gen_profiles_solution.py index f614ff9c..b72504e6 100644 --- a/scripts/gen_profiles_solution.py +++ b/scripts/gen_profiles_solution.py @@ -210,58 +210,146 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): const VpBlockProperties* pEnabledProfileBlocks; } VpDeviceCreateInfo; -VK_DEFINE_HANDLE(VpCapabilities) +VK_DEFINE_HANDLE(VpFunctions) -typedef enum VpCapabilitiesCreateFlagBits { - VP_PROFILE_CREATE_STATIC_BIT = (1 << 0), - //VP_PROFILE_CREATE_DYNAMIC_BIT = (1 << 1), - VP_PROFILE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VpCapabilitiesCreateFlagBits; +typedef VpFunctions VpCapabilities; -typedef VkFlags VpCapabilitiesCreateFlags; +typedef enum VpFunctionsCreateFlagBits { + VP_FUNCTIONS_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VpFunctionsCreateFlagBits; -// Pointers to some Vulkan functions - a subset used by the library. -// Used in VpCapabilitiesCreateInfo::pVulkanFunctions. +typedef VkFlags VpFunctionsCreateFlags; -typedef struct VpVulkanFunctions { - /// Required when using VP_DYNAMIC_VULKAN_FUNCTIONS. - PFN_vkGetInstanceProcAddr GetInstanceProcAddr; - /// Required when using VP_DYNAMIC_VULKAN_FUNCTIONS. - PFN_vkGetDeviceProcAddr GetDeviceProcAddr; +typedef enum VpInstanceFunctionsLoadFlagBits { + VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT = (1 << 0), + VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT = (1 << 1), + VP_INSTANCE_FUNCTIONS_LOAD_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VpInstanceFunctionsLoadFlagBits; + +typedef VkFlags VpInstanceFunctionsLoadFlags; + +struct VpFunctions_T { + static VpFunctions_T& Get() { + static VpFunctions_T instance; + return instance; + } + + VpFunctions_T() { +#ifndef VK_NO_PROTOTYPES + ImportVulkanFunctions_Static(); +#endif//VK_NO_PROTOTYPES + } + + VkResult validate(bool full_init = false) const { + // Validate global vulkan function initialization + // vkEnumerateInstanceVersion is omitted from validation on purpose. + // It is not available in Vulkan 1.0, and nullptr is a valid state indicating Vulkan 1.0. + + if (this->EnumerateInstanceExtensionProperties == nullptr || + this->CreateInstance == nullptr || + this->GetInstanceProcAddr == nullptr) { + return VK_ERROR_INITIALIZATION_FAILED; + } + + if (full_init) { + if (this->GetPhysicalDeviceFeatures2 == nullptr || + this->GetPhysicalDeviceProperties2 == nullptr || + this->GetPhysicalDeviceFormatProperties2 == nullptr || + this->GetPhysicalDeviceQueueFamilyProperties2 == nullptr) { + return VK_ERROR_INITIALIZATION_FAILED; + } + } + + return VK_SUCCESS; + } + + PFN_vkGetInstanceProcAddr GetInstanceProcAddr = nullptr; PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; - PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; - PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; - PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; - PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2; - PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2; - PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2; - PFN_vkCreateInstance CreateInstance; - PFN_vkCreateDevice CreateDevice; -} VpVulkanFunctions; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = nullptr; + PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties = nullptr; + PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2 = nullptr; + PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2 = nullptr; + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2 = nullptr; + PFN_vkCreateInstance CreateInstance = nullptr; + PFN_vkCreateDevice CreateDevice = nullptr; + +private: +#ifndef VK_NO_PROTOTYPES + void ImportVulkanFunctions_Static() { + #define VP_SET_STATIC(memberName, staticFuncName) this->memberName = (PFN_vk##memberName)staticFuncName + + VP_SET_STATIC(GetInstanceProcAddr, vkGetInstanceProcAddr); + + VP_SET_STATIC(EnumerateInstanceVersion, vkEnumerateInstanceVersion); + VP_SET_STATIC(EnumerateInstanceExtensionProperties, vkEnumerateInstanceExtensionProperties); + VP_SET_STATIC(EnumerateDeviceExtensionProperties, vkEnumerateDeviceExtensionProperties); + + VP_SET_STATIC(GetPhysicalDeviceFeatures2, vkGetPhysicalDeviceFeatures2); + VP_SET_STATIC(GetPhysicalDeviceProperties2, vkGetPhysicalDeviceProperties2); + VP_SET_STATIC(GetPhysicalDeviceFormatProperties2, vkGetPhysicalDeviceFormatProperties2); + VP_SET_STATIC(GetPhysicalDeviceQueueFamilyProperties2, vkGetPhysicalDeviceQueueFamilyProperties2); + + VP_SET_STATIC(CreateInstance, vkCreateInstance); + VP_SET_STATIC(CreateDevice, vkCreateDevice); + + #undef VP_SET_STATIC + } +#endif//VK_NO_PROTOTYPES +}; /// Description of a Allocator to be created. -typedef struct VpCapabilitiesCreateInfo +typedef struct VpFunctionsCreateInfo { /// Flags for created allocator. Use #VpInstanceCreateFlagBits enum. - VpCapabilitiesCreateFlags flags; - uint32_t apiVersion; - const VpVulkanFunctions* pVulkanFunctions; -} VpCapabilitiesCreateInfo; + VpFunctionsCreateFlags flags; + + PFN_vkGetInstanceProcAddr GetInstanceProcAddr = nullptr; + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = nullptr; + PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties = nullptr; + PFN_vkCreateInstance CreateInstance = nullptr; + PFN_vkCreateDevice CreateDevice = nullptr; + PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2 = nullptr; + PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2 = nullptr; + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2 = nullptr; +} VpFunctionsCreateInfo; -VPAPI_ATTR VkResult vpCreateCapabilities( - const VpCapabilitiesCreateInfo* pCreateInfo, +#ifdef VP_USE_OBJECT + +VPAPI_ATTR VkResult vpCreateFunctions( + const VpFunctionsCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, - VpCapabilities* pCapabilities); + VpFunctions* pFunctions +); /// Destroys allocator object. -VPAPI_ATTR void vpDestroyCapabilities( - VpCapabilities capabilities, +VPAPI_ATTR void vpDestroyFunctions( + VpFunctions functions, const VkAllocationCallbacks* pAllocator); +#endif//VP_USE_OBJECT + +/// Helper function to initialize a VpFunctions instance with global Vulkan functions loaded with GetInstanceProcAddr +VPAPI_ATTR VkResult vpInitializeGlobalFunctions( +#ifdef VP_USE_OBJECT + VpFunctions functions, +#endif//VP_USE_OBJECT + PFN_vkGetInstanceProcAddr GetInstanceProcAddr); + +/// Initializes capabilities with instance functions +VPAPI_ATTR VkResult vpInitializeInstanceFunctions( +#ifdef VP_USE_OBJECT + VpFunctions functions, +#endif//VP_USE_OBJECT + VkInstance instance, + VpInstanceFunctionsLoadFlags flags); + // Query the list of available profiles in the library VPAPI_ATTR VkResult vpGetProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT uint32_t* pPropertyCount, VpProfileProperties* pProperties); @@ -269,7 +357,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // List the required profiles of a profile VPAPI_ATTR VkResult vpGetProfileRequiredProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, uint32_t* pPropertyCount, @@ -278,14 +366,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the profile required Vulkan API version VPAPI_ATTR uint32_t vpGetProfileAPIVersion( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile); // List the recommended fallback profiles of a profile VPAPI_ATTR VkResult vpGetProfileFallbacks( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, uint32_t* pPropertyCount, @@ -294,7 +382,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query whether the profile has multiple variants. Profiles with multiple variants can only use vpGetInstanceProfileSupport and vpGetPhysicalDeviceProfileSupport capabilities of the library. Other function will return a VK_ERROR_UNKNOWN error VPAPI_ATTR VkResult vpHasMultipleVariantsProfile( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, VkBool32* pHasMultipleVariants); @@ -302,7 +390,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Check whether a profile is supported at the instance level VPAPI_ATTR VkResult vpGetInstanceProfileSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const char* pLayerName, const VpProfileProperties* pProfile, @@ -311,7 +399,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Check whether a variant of a profile is supported at the instance level and report this list of blocks used to validate the profiles VPAPI_ATTR VkResult vpGetInstanceProfileVariantsSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const char* pLayerName, const VpProfileProperties* pProfile, @@ -322,7 +410,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Create a VkInstance with the profile instance extensions enabled VPAPI_ATTR VkResult vpCreateInstance( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, @@ -331,7 +419,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Check whether a profile is supported by the physical device VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT VkInstance instance, VkPhysicalDevice physicalDevice, @@ -341,7 +429,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Check whether a variant of a profile is supported by the physical device and report this list of blocks used to validate the profiles VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileVariantsSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT VkInstance instance, VkPhysicalDevice physicalDevice, @@ -353,7 +441,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Create a VkDevice with the profile features and device extensions enabled VPAPI_ATTR VkResult vpCreateDevice( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT VkPhysicalDevice physicalDevice, const VpDeviceCreateInfo* pCreateInfo, @@ -363,7 +451,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of instance extensions of a profile VPAPI_ATTR VkResult vpGetProfileInstanceExtensionProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -373,7 +461,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of device extensions of a profile VPAPI_ATTR VkResult vpGetProfileDeviceExtensionProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -383,7 +471,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Fill the feature structures with the requirements of a profile VPAPI_ATTR VkResult vpGetProfileFeatures( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -392,7 +480,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of feature structure types specified by the profile VPAPI_ATTR VkResult vpGetProfileFeatureStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -402,7 +490,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Fill the property structures with the requirements of a profile VPAPI_ATTR VkResult vpGetProfileProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -411,7 +499,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of property structure types specified by the profile VPAPI_ATTR VkResult vpGetProfilePropertyStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -421,7 +509,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Fill the queue family property structures with the requirements of a profile VPAPI_ATTR VkResult vpGetProfileQueueFamilyProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -431,7 +519,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of queue family property structure types specified by the profile VPAPI_ATTR VkResult vpGetProfileQueueFamilyStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -441,7 +529,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of formats with specified requirements by a profile VPAPI_ATTR VkResult vpGetProfileFormats( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -451,7 +539,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the requirements of a format for a profile VPAPI_ATTR VkResult vpGetProfileFormatProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -461,7 +549,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of format structure types specified by the profile VPAPI_ATTR VkResult vpGetProfileFormatStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -472,7 +560,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of video profiles specified by the profile VPAPI_ATTR VkResult vpGetProfileVideoProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -482,7 +570,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the video profile info structures for a video profile defined by a profile VPAPI_ATTR VkResult vpGetProfileVideoProfileInfo( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -492,7 +580,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of video profile info structure types specified by the profile for a video profile VPAPI_ATTR VkResult vpGetProfileVideoProfileInfoStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -503,7 +591,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the video capabilities requirements for a video profile defined by a profile VPAPI_ATTR VkResult vpGetProfileVideoCapabilities( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -513,7 +601,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of video capability structure types specified by the profile for a video profile VPAPI_ATTR VkResult vpGetProfileVideoCapabilityStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -524,7 +612,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the video format property requirements for a video profile defined by a profile VPAPI_ATTR VkResult vpGetProfileVideoFormatProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -535,7 +623,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of video format property structure types specified by the profile for a video profile VPAPI_ATTR VkResult vpGetProfileVideoFormatStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -940,7 +1028,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -948,9 +1036,16 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pStructureTypeCount, VkStructureType* pStructureTypes) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = pBlockName == nullptr ? VK_SUCCESS : VK_INCOMPLETE; std::vector results; @@ -1033,7 +1128,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileExtensionProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -1041,9 +1136,16 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pPropertyCount, VkExtensionProperties* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = pBlockName == nullptr ? VK_SUCCESS : VK_INCOMPLETE; std::vector results; @@ -1152,206 +1254,161 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): ''' PUBLIC_IMPL_BODY = ''' -struct VpCapabilities_T : public VpVulkanFunctions { - bool singleton = false; - uint32_t apiVersion = VK_API_VERSION_1_0; - - static VpCapabilities_T& Get() { - static VpCapabilities_T instance; - VpCapabilitiesCreateInfo createInfo{}; - createInfo.flags = VP_PROFILE_CREATE_STATIC_BIT; - instance.init(&createInfo); - instance.singleton = true; - return instance; - } +#ifdef VP_USE_OBJECT - VpCapabilities_T() { - this->GetInstanceProcAddr = nullptr; - this->GetDeviceProcAddr = nullptr; - this->EnumerateInstanceVersion = nullptr; - this->EnumerateInstanceExtensionProperties = nullptr; - this->EnumerateDeviceExtensionProperties = nullptr; - this->GetPhysicalDeviceFeatures2 = nullptr; - this->GetPhysicalDeviceProperties2 = nullptr; - this->GetPhysicalDeviceFormatProperties2 = nullptr; - this->GetPhysicalDeviceQueueFamilyProperties2 = nullptr; - this->CreateInstance = nullptr; - this->CreateDevice = nullptr; +VPAPI_ATTR VkResult vpCreateFunctions( + const VpFunctionsCreateInfo* pFunctionsCreateInfo, + const VkAllocationCallbacks* pAllocator, + VpFunctions* pFunctions) { + (void)pAllocator; + (void)pFunctionsCreateInfo; + VpFunctions_T* functions = new (std::nothrow) VpFunctions_T(); + *pFunctions = functions; + if (!functions) { + return VK_ERROR_INITIALIZATION_FAILED; } - VkResult init(const VpCapabilitiesCreateInfo* pCreateInfo) { - assert(pCreateInfo != nullptr); +#define VP_COPY_IF_NOT_NULL(funcName) \ + if(pFunctionsCreateInfo->funcName != nullptr) \ + functions->funcName = pFunctionsCreateInfo->funcName; - return ImportVulkanFunctions(pCreateInfo); - } + VP_COPY_IF_NOT_NULL(GetInstanceProcAddr); - VkResult ImportVulkanFunctions(const VpCapabilitiesCreateInfo* pCreateInfo) { - if (pCreateInfo->flags & VP_PROFILE_CREATE_STATIC_BIT) { - ImportVulkanFunctions_Static(); - } + VP_COPY_IF_NOT_NULL(EnumerateInstanceVersion); + VP_COPY_IF_NOT_NULL(EnumerateInstanceExtensionProperties); + VP_COPY_IF_NOT_NULL(EnumerateDeviceExtensionProperties); - if (pCreateInfo->pVulkanFunctions != nullptr) { - ImportVulkanFunctions_Custom((VpVulkanFunctions*)pCreateInfo->pVulkanFunctions); - } -/* - if (pCreateInfo->flags & VP_PROFILE_CREATE_DYNAMIC_BIT) { - ImportVulkanFunctions_Dynamic(); - } -*/ - return ValidateVulkanFunctions(); - } - - void ImportVulkanFunctions_Static() { - // Vulkan 1.1 - this->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)vkGetInstanceProcAddr; - this->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)vkGetDeviceProcAddr; - - this->EnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion)vkEnumerateInstanceVersion; - this->EnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties)vkEnumerateInstanceExtensionProperties; - this->EnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties)vkEnumerateDeviceExtensionProperties; + VP_COPY_IF_NOT_NULL(GetPhysicalDeviceFeatures2); + VP_COPY_IF_NOT_NULL(GetPhysicalDeviceProperties2); + VP_COPY_IF_NOT_NULL(GetPhysicalDeviceFormatProperties2); + VP_COPY_IF_NOT_NULL(GetPhysicalDeviceQueueFamilyProperties2); - this->GetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2)vkGetPhysicalDeviceFeatures2; - this->GetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2)vkGetPhysicalDeviceProperties2; - this->GetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2)vkGetPhysicalDeviceFormatProperties2; - this->GetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2)vkGetPhysicalDeviceQueueFamilyProperties2; + VP_COPY_IF_NOT_NULL(CreateInstance); + VP_COPY_IF_NOT_NULL(CreateDevice); - this->CreateInstance = (PFN_vkCreateInstance)vkCreateInstance; - this->CreateDevice = (PFN_vkCreateDevice)vkCreateDevice; - } +#undef VP_COPY_IF_NOT_NULL - void ImportVulkanFunctions_Custom(VpVulkanFunctions* pFunctions) { - #define VP_COPY_IF_NOT_NULL(funcName) \ - if(pFunctions->funcName != nullptr) this->funcName = pFunctions->funcName; + return functions->validate(); +} - VP_COPY_IF_NOT_NULL(GetInstanceProcAddr); - VP_COPY_IF_NOT_NULL(GetDeviceProcAddr); +/// Destroys allocator object. +VPAPI_ATTR void vpDestroyFunctions( + VpFunctions functions, + const VkAllocationCallbacks* pAllocator) { + (void)pAllocator; + + delete functions; +} - VP_COPY_IF_NOT_NULL(EnumerateInstanceVersion); - VP_COPY_IF_NOT_NULL(EnumerateInstanceExtensionProperties); - VP_COPY_IF_NOT_NULL(EnumerateDeviceExtensionProperties); +#endif//VP_USE_OBJECT - VP_COPY_IF_NOT_NULL(GetPhysicalDeviceFeatures2); - VP_COPY_IF_NOT_NULL(GetPhysicalDeviceProperties2); - VP_COPY_IF_NOT_NULL(GetPhysicalDeviceFormatProperties2); - VP_COPY_IF_NOT_NULL(GetPhysicalDeviceQueueFamilyProperties2); +/// Helper function to initialize VpFunctions instance with global Vulkan functions +VPAPI_ATTR VkResult vpInitializeGlobalFunctions( +#ifdef VP_USE_OBJECT + VpFunctions functions, +#endif//VP_USE_OBJECT + PFN_vkGetInstanceProcAddr GetInstanceProcAddr) { - VP_COPY_IF_NOT_NULL(CreateInstance); - VP_COPY_IF_NOT_NULL(CreateDevice); - #undef VP_COPY_IF_NOT_NULL - } -/* - VkResult ImportVulkanFunctions_Dynamic() { - // To use VP_PROFILE_CREATE_DYNAMIC_BIT you have to pass VpVulkanFunctions::vkGetInstanceProcAddr and vkGetDeviceProcAddr as VpCapabilitiesCreateInfo::pVulkanFunctions. Other members can be null. - if (this->GetInstanceProcAddr == nullptr || this->GetDeviceProcAddr == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } +#ifdef VP_USE_OBJECT + VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + VpFunctions_T& vp = VpFunctions_T::Get(); +#endif//VP_USE_OBJECT - #define VP_FETCH_INSTANCE_FUNC(memberName, functionNameString) \ - if(this->memberName == nullptr) \ - this->memberName = (PFN_vk##memberName)this->GetInstanceProcAddr(m_hInstance, functionNameString); - #define VP_FETCH_DEVICE_FUNC(memberName, functionNameString) \ - if(this->memberName == nullptr) \ - this->memberName = (PFN_vk##memberName)this->GetDeviceProcAddr(m_hDevice, functionNameString); - - VP_FETCH_INSTANCE_FUNC(GetInstanceProcAddr, "vkGetInstanceProcAddr"); - VP_FETCH_DEVICE_FUNC(GetDeviceProcAddr, "vkGetDeviceProcAddr"); - - VP_FETCH_INSTANCE_FUNC(EnumerateInstanceVersion, "vkEnumerateInstanceVersion"); - VP_FETCH_INSTANCE_FUNC(EnumerateInstanceExtensionProperties, "vkEnumerateInstanceExtensionProperties"); - VP_FETCH_DEVICE_FUNC(EnumerateDeviceExtensionProperties, "vkEnumerateDeviceExtensionProperties"); - - VP_FETCH_DEVICE_FUNC(GetPhysicalDeviceFeatures2, "vkGetPhysicalDeviceFeatures2"); - VP_FETCH_DEVICE_FUNC(GetPhysicalDeviceProperties2, "vkGetPhysicalDeviceProperties2"); - VP_FETCH_DEVICE_FUNC(GetPhysicalDeviceFormatProperties2, "vkGetPhysicalDeviceFormatProperties2"); - VP_FETCH_DEVICE_FUNC(GetPhysicalDeviceQueueFamilyProperties2, "vkGetPhysicalDeviceQueueFamilyProperties2"); - - VP_FETCH_INSTANCE_FUNC(CreateInstance, "vkCreateInstance"); - VP_FETCH_DEVICE_FUNC(CreateDevice, "vkCreateDevice"); - #undef VP_FETCH_DEVICE_FUNC - #undef VP_FETCH_INSTANCE_FUNC + if (GetInstanceProcAddr == nullptr) { + return VK_ERROR_INITIALIZATION_FAILED; } -*/ - VkResult ValidateVulkanFunctions() { - if (this->GetInstanceProcAddr == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } - if (this->GetDeviceProcAddr == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } + vp.GetInstanceProcAddr = GetInstanceProcAddr; - if (this->EnumerateInstanceVersion == nullptr && apiVersion >= VK_API_VERSION_1_1) { - return VK_ERROR_INITIALIZATION_FAILED; - } +#define VP_FETCH_FUNC(memberName, functionNameString) \ + vp.memberName = (PFN_vk##memberName)vp.GetInstanceProcAddr(nullptr, functionNameString) - if (this->EnumerateInstanceExtensionProperties == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } + VP_FETCH_FUNC(EnumerateInstanceVersion, "vkEnumerateInstanceVersion"); + VP_FETCH_FUNC(EnumerateInstanceExtensionProperties, "vkEnumerateInstanceExtensionProperties"); + VP_FETCH_FUNC(CreateInstance, "vkCreateInstance"); - if (this->EnumerateDeviceExtensionProperties == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } +#undef VP_FETCH_FUNC - if (this->GetPhysicalDeviceFeatures2 == nullptr) { - return apiVersion >= VK_API_VERSION_1_1 ? VK_ERROR_INITIALIZATION_FAILED : VK_ERROR_EXTENSION_NOT_PRESENT; - } + return vp.validate(); +} - if (this->GetPhysicalDeviceProperties2 == nullptr) { - return apiVersion >= VK_API_VERSION_1_1 ? VK_ERROR_INITIALIZATION_FAILED : VK_ERROR_EXTENSION_NOT_PRESENT; - } +/// Initializes capabilities with instance functions +VPAPI_ATTR VkResult vpInitializeInstanceFunctions( +#ifdef VP_USE_OBJECT + VpFunctions functions, +#endif//VP_USE_OBJECT + VkInstance instance, + VpInstanceFunctionsLoadFlags flags) { +#ifdef VP_USE_OBJECT + VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + VpFunctions_T& vp = VpFunctions_T::Get(); +#endif//VP_USE_OBJECT - if (this->GetPhysicalDeviceFormatProperties2 == nullptr) { - return apiVersion >= VK_API_VERSION_1_1 ? VK_ERROR_INITIALIZATION_FAILED : VK_ERROR_EXTENSION_NOT_PRESENT; - } +#define VP_FETCH_FUNC(memberName, functionNameString) \ + if (((flags & VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT) && vp.memberName == nullptr) || !(flags & VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT)) \ + vp.memberName = (PFN_vk##memberName)vp.GetInstanceProcAddr(instance, functionNameString); - if (this->GetPhysicalDeviceQueueFamilyProperties2 == nullptr) { - return apiVersion >= VK_API_VERSION_1_1 ? VK_ERROR_INITIALIZATION_FAILED : VK_ERROR_EXTENSION_NOT_PRESENT; - } + VP_FETCH_FUNC(EnumerateDeviceExtensionProperties, "vkEnumerateDeviceExtensionProperties"); + VP_FETCH_FUNC(GetPhysicalDeviceFeatures2, "vkGetPhysicalDeviceFeatures2"); + if (!vp.GetPhysicalDeviceFeatures2 && (flags & VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT)) { + VP_FETCH_FUNC(GetPhysicalDeviceFeatures2, "vkGetPhysicalDeviceFeatures2KHR"); + } - if (this->CreateInstance == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } + VP_FETCH_FUNC(GetPhysicalDeviceProperties2, "vkGetPhysicalDeviceProperties2"); + if (!vp.GetPhysicalDeviceProperties2 && (flags & VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT)) { + VP_FETCH_FUNC(GetPhysicalDeviceProperties2, "vkGetPhysicalDeviceProperties2KHR"); + } - if (this->CreateDevice == nullptr) { - return VK_ERROR_INITIALIZATION_FAILED; - } + VP_FETCH_FUNC(GetPhysicalDeviceFormatProperties2, "vkGetPhysicalDeviceFormatProperties2"); + if (!vp.GetPhysicalDeviceFormatProperties2 && (flags & VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT)) { + VP_FETCH_FUNC(GetPhysicalDeviceFormatProperties2, "vkGetPhysicalDeviceFormatProperties2KHR"); + } - return VK_SUCCESS; + VP_FETCH_FUNC(GetPhysicalDeviceQueueFamilyProperties2, "vkGetPhysicalDeviceQueueFamilyProperties2"); + if (!vp.GetPhysicalDeviceQueueFamilyProperties2 && (flags & VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT)) { + VP_FETCH_FUNC(GetPhysicalDeviceQueueFamilyProperties2, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); } -}; -VPAPI_ATTR VkResult vpCreateCapabilities( - const VpCapabilitiesCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VpCapabilities* pCapabilities) { - (void)pAllocator; + VP_FETCH_FUNC(CreateDevice, "vkCreateDevice"); +#undef VP_FETCH_FUNC - VpCapabilities_T* capabilities = new VpCapabilities_T(); - VkResult result = capabilities->init(pCreateInfo); - *pCapabilities = capabilities; + // Validate the instance functions are loaded correctly + if (vp.EnumerateDeviceExtensionProperties == nullptr || + vp.CreateDevice == nullptr) { + return VK_ERROR_INITIALIZATION_FAILED; + } - return result; -} + bool requiresProperties2 = (flags & VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT); -/// Destroys allocator object. -VPAPI_ATTR void vpDestroyCapabilities( - VpCapabilities capabilities, - const VkAllocationCallbacks* pAllocator) { - (void)pAllocator; - - delete capabilities; + if (vp.GetPhysicalDeviceFeatures2 == nullptr || + vp.GetPhysicalDeviceProperties2 == nullptr || + vp.GetPhysicalDeviceFormatProperties2 == nullptr || + vp.GetPhysicalDeviceQueueFamilyProperties2 == nullptr) { + return requiresProperties2 ? VK_ERROR_INITIALIZATION_FAILED : VK_ERROR_EXTENSION_NOT_PRESENT; + } + + return VK_SUCCESS; } VPAPI_ATTR VkResult vpGetProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT uint32_t* pPropertyCount, VpProfileProperties* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = VK_SUCCESS; if (pProperties == nullptr) { @@ -1371,15 +1428,22 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileRequiredProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, uint32_t* pPropertyCount, VpProfileProperties* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = VK_SUCCESS; const detail::VpProfileDesc* desc = detail::vpGetProfileDesc(pProfile->profileName); @@ -1404,13 +1468,20 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR uint32_t vpGetProfileAPIVersion( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + const std::vector& gathered_profiles = detail::GatherProfiles(*pProfile, nullptr); uint32_t major = 0; @@ -1433,15 +1504,22 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileFallbacks( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, uint32_t* pPropertyCount, VpProfileProperties* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(true); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = VK_SUCCESS; const detail::VpProfileDesc* desc = detail::vpGetProfileDesc(pProfile->profileName); @@ -1466,14 +1544,21 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpHasMultipleVariantsProfile( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, VkBool32* pHasMultipleVariants) { #ifdef VP_USE_OBJECT - (void)capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(true); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + const std::vector& gathered_profiles = detail::GatherProfiles(*pProfile, nullptr); for (std::size_t profile_index = 0, profile_count = gathered_profiles.size(); profile_index < profile_count; ++profile_index) { @@ -1496,7 +1581,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetInstanceProfileVariantsSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const char* pLayerName, const VpProfileProperties* pProfile, @@ -1504,16 +1589,20 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pPropertyCount, VpBlockProperties* pProperties) { #ifdef VP_USE_OBJECT - const VpCapabilities_T& vp = capabilities == nullptr ? VpCapabilities_T::Get() : *capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; #else - const VpCapabilities_T& vp = VpCapabilities_T::Get(); + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = VK_SUCCESS; uint32_t api_version = VK_API_VERSION_1_0; - PFN_vkEnumerateInstanceVersion pfnEnumerateInstanceVersion = vp.singleton ? - (PFN_vkEnumerateInstanceVersion)vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion") : vp.EnumerateInstanceVersion; + PFN_vkEnumerateInstanceVersion pfnEnumerateInstanceVersion = vp.EnumerateInstanceVersion; if (pfnEnumerateInstanceVersion != nullptr) { result = pfnEnumerateInstanceVersion(&api_version); if (result != VK_SUCCESS) { @@ -1598,33 +1687,48 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetInstanceProfileSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const char* pLayerName, const VpProfileProperties* pProfile, VkBool32* pSupported) { - uint32_t count = 0; +#ifdef VP_USE_OBJECT + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; +#else + const VpFunctions_T& vp = VpFunctions_T::Get(); +#endif//VP_USE_OBJECT + + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + uint32_t count = 0; return vpGetInstanceProfileVariantsSupport( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pLayerName, pProfile, pSupported, &count, nullptr); } VPAPI_ATTR VkResult vpCreateInstance( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) { #ifdef VP_USE_OBJECT - const VpCapabilities_T& vp = capabilities == nullptr ? VpCapabilities_T::Get() : *capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; #else - const VpCapabilities_T& vp = VpCapabilities_T::Get(); + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(false); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + if (pCreateInfo == nullptr || pInstance == nullptr) { return vp.CreateInstance(pCreateInfo == nullptr ? nullptr : pCreateInfo->pCreateInfo, pAllocator, pInstance); } @@ -1667,7 +1771,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): } else if (!blocks.empty()) { appInfo.apiVersion = vpGetProfileAPIVersion( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT &blocks[0].profiles); } @@ -1675,6 +1779,8 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkInstanceCreateInfo createInfo = *pCreateInfo->pCreateInfo; createInfo.pApplicationInfo = &appInfo; + bool use_gpdp2 = false; + // Need to include VK_KHR_get_physical_device_properties2 if we are on Vulkan 1.0 if (createInfo.pApplicationInfo->apiVersion < VK_API_VERSION_1_1) { bool foundGPDP2 = false; @@ -1686,6 +1792,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): } if (!foundGPDP2) { extensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + use_gpdp2 = true; } } @@ -1710,25 +1817,45 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): createInfo.ppEnabledExtensionNames = extensions.data(); } - return vp.CreateInstance(&createInfo, pAllocator, pInstance); + VkResult result = vp.CreateInstance(&createInfo, pAllocator, pInstance); + + if (result == VK_SUCCESS) { + VpInstanceFunctionsLoadFlags flags = VP_INSTANCE_FUNCTIONS_LOAD_MISSING_ONLY_BIT; + if (use_gpdp2) { + flags |= VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT; + } + + result = vpInitializeInstanceFunctions( +#ifdef VP_USE_OBJECT + functions, +#endif//VP_USE_OBJECT + *pInstance, flags); + } + + return result; } VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileVariantsSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT - VkInstance instance, - VkPhysicalDevice physicalDevice, - const VpProfileProperties *pProfile, - VkBool32 *pSupported, - uint32_t *pPropertyCount, - VpBlockProperties* pProperties) { + VkInstance instance, + VkPhysicalDevice physicalDevice, + const VpProfileProperties* pProfile, + VkBool32* pSupported, + uint32_t* pPropertyCount, + VpBlockProperties* pProperties) { #ifdef VP_USE_OBJECT - const VpCapabilities_T& vp = capabilities == nullptr ? VpCapabilities_T::Get() : *capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; #else - const VpCapabilities_T& vp = VpCapabilities_T::Get(); + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT + VkResult result_validate = vp.validate(true); + if (result_validate != VK_SUCCESS) { + return result_validate; + } + VkResult result = VK_SUCCESS; uint32_t supported_device_extension_count = 0; @@ -1793,36 +1920,10 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): bool supported; } userData{physicalDevice, supported_blocks, unsupported_blocks}; - if (!vp.singleton) { - userData.gpdp2.pfnGetPhysicalDeviceFeatures2 = vp.GetPhysicalDeviceFeatures2; - userData.gpdp2.pfnGetPhysicalDeviceProperties2 = vp.GetPhysicalDeviceProperties2; - userData.gpdp2.pfnGetPhysicalDeviceFormatProperties2 = vp.GetPhysicalDeviceFormatProperties2; - userData.gpdp2.pfnGetPhysicalDeviceQueueFamilyProperties2 = vp.GetPhysicalDeviceQueueFamilyProperties2; - } - - // Attempt to load core versions of the GPDP2 entry points - if (userData.gpdp2.pfnGetPhysicalDeviceFeatures2 == nullptr) { - userData.gpdp2.pfnGetPhysicalDeviceFeatures2 = - (PFN_vkGetPhysicalDeviceFeatures2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2"); - userData.gpdp2.pfnGetPhysicalDeviceProperties2 = - (PFN_vkGetPhysicalDeviceProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2"); - userData.gpdp2.pfnGetPhysicalDeviceFormatProperties2 = - (PFN_vkGetPhysicalDeviceFormatProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2"); - userData.gpdp2.pfnGetPhysicalDeviceQueueFamilyProperties2 = - (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2"); - } - - // If not successful, try to load KHR variant - if (userData.gpdp2.pfnGetPhysicalDeviceFeatures2 == nullptr) { - userData.gpdp2.pfnGetPhysicalDeviceFeatures2 = - (PFN_vkGetPhysicalDeviceFeatures2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2KHR"); - userData.gpdp2.pfnGetPhysicalDeviceProperties2 = - (PFN_vkGetPhysicalDeviceProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR"); - userData.gpdp2.pfnGetPhysicalDeviceFormatProperties2 = - (PFN_vkGetPhysicalDeviceFormatProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR"); - userData.gpdp2.pfnGetPhysicalDeviceQueueFamilyProperties2 = - (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); - } + userData.gpdp2.pfnGetPhysicalDeviceFeatures2 = vp.GetPhysicalDeviceFeatures2; + userData.gpdp2.pfnGetPhysicalDeviceProperties2 = vp.GetPhysicalDeviceProperties2; + userData.gpdp2.pfnGetPhysicalDeviceFormatProperties2 = vp.GetPhysicalDeviceFormatProperties2; + userData.gpdp2.pfnGetPhysicalDeviceQueueFamilyProperties2 = vp.GetPhysicalDeviceQueueFamilyProperties2; if (userData.gpdp2.pfnGetPhysicalDeviceFeatures2 == nullptr || userData.gpdp2.pfnGetPhysicalDeviceProperties2 == nullptr || @@ -1832,7 +1933,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): } #ifdef VK_KHR_video_queue - PFN_vkGetInstanceProcAddr gipa = vp.singleton ? vkGetInstanceProcAddr : vp.GetInstanceProcAddr; + PFN_vkGetInstanceProcAddr gipa = vp.GetInstanceProcAddr; userData.video.pfnGetPhysicalDeviceVideoCapabilitiesKHR = (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)gipa(instance, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); userData.video.pfnGetPhysicalDeviceVideoFormatPropertiesKHR = @@ -2148,7 +2249,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileSupport( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT VkInstance instance, VkPhysicalDevice physicalDevice, @@ -2158,23 +2259,23 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): return vpGetPhysicalDeviceProfileVariantsSupport( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT instance, physicalDevice, pProfile, pSupported, &count, nullptr); } VPAPI_ATTR VkResult vpCreateDevice( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT VkPhysicalDevice physicalDevice, const VpDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) { #ifdef VP_USE_OBJECT - const VpCapabilities_T& vp = capabilities == nullptr ? VpCapabilities_T::Get() : *capabilities; + const VpFunctions_T& vp = functions == nullptr ? VpFunctions_T::Get() : *functions; #else - const VpCapabilities_T& vp = VpCapabilities_T::Get(); + const VpFunctions_T& vp = VpFunctions_T::Get(); #endif//VP_USE_OBJECT if (physicalDevice == VK_NULL_HANDLE || pCreateInfo == nullptr || pDevice == nullptr) { @@ -2195,7 +2296,9 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): for (std::size_t block_index = 0, block_count = blocks.size(); block_index < block_count; ++block_index) { const detail::VpProfileDesc* pProfileDesc = detail::vpGetProfileDesc(blocks[block_index].profiles.profileName); - if (pProfileDesc == nullptr) return VK_ERROR_UNKNOWN; + if (pProfileDesc == nullptr) { + return VK_ERROR_UNKNOWN; + } for (std::size_t caps_index = 0, caps_count = pProfileDesc->requiredCapabilityCount; caps_index < caps_count; ++caps_index) { const detail::VpCapabilitiesDesc* pCapsDesc = &pProfileDesc->pRequiredCapabilities[caps_index]; @@ -2276,7 +2379,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileInstanceExtensionProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2284,14 +2387,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkExtensionProperties* pProperties) { return detail::vpGetProfileExtensionProperties( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::EXTENSION_INSTANCE, pPropertyCount, pProperties); } VPAPI_ATTR VkResult vpGetProfileDeviceExtensionProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2299,20 +2402,20 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkExtensionProperties* pProperties) { return detail::vpGetProfileExtensionProperties( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::EXTENSION_DEVICE, pPropertyCount, pProperties); } VPAPI_ATTR VkResult vpGetProfileFeatures( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, void* pNext) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT VkResult result = pBlockName == nullptr ? VK_SUCCESS : VK_INCOMPLETE; @@ -2351,7 +2454,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2361,7 +2464,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkBool32 multiple_variants = VK_FALSE; if (vpHasMultipleVariantsProfile( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, &multiple_variants) == VK_ERROR_UNKNOWN) { @@ -2405,14 +2508,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileQueueFamilyProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pPropertyCount, VkQueueFamilyProperties2KHR* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT if (pPropertyCount == nullptr) return VK_ERROR_UNKNOWN; @@ -2470,14 +2573,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileFormats( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pFormatCount, VkFormat* pFormats) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT VkResult result = pBlockName == nullptr ? VK_SUCCESS : VK_INCOMPLETE; @@ -2531,14 +2634,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileFormatProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, VkFormat format, void* pNext) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT VkResult result = pBlockName == nullptr ? VK_SUCCESS : VK_INCOMPLETE; @@ -2604,7 +2707,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileFeatureStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2612,14 +2715,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkStructureType* pStructureTypes) { return detail::vpGetProfileStructureTypes( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::STRUCTURE_FEATURE, pStructureTypeCount, pStructureTypes); } VPAPI_ATTR VkResult vpGetProfilePropertyStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2627,14 +2730,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkStructureType* pStructureTypes) { return detail::vpGetProfileStructureTypes( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::STRUCTURE_PROPERTY, pStructureTypeCount, pStructureTypes); } VPAPI_ATTR VkResult vpGetProfileQueueFamilyStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2642,14 +2745,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkStructureType* pStructureTypes) { return detail::vpGetProfileStructureTypes( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::STRUCTURE_QUEUE_FAMILY, pStructureTypeCount, pStructureTypes); } VPAPI_ATTR VkResult vpGetProfileFormatStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2657,7 +2760,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VkStructureType* pStructureTypes) { return detail::vpGetProfileStructureTypes( #ifdef VP_USE_OBJECT - capabilities, + functions, #endif//VP_USE_OBJECT pProfile, pBlockName, detail::STRUCTURE_FORMAT, pStructureTypeCount, pStructureTypes); } @@ -2666,14 +2769,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): // Query the list of video profiles specified by the profile VPAPI_ATTR VkResult vpGetProfileVideoProfiles( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, uint32_t* pVideoProfileCount, VpVideoProfileProperties* pVideoProfiles) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT if (pVideoProfileCount == nullptr) return VK_ERROR_UNKNOWN; @@ -2723,14 +2826,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoProfileInfo( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, VkVideoProfileInfoKHR* pVideoProfileInfo) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr; @@ -2749,14 +2852,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoCapabilities( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, uint32_t videoProfileIndex, void* pNext) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr; @@ -2775,7 +2878,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoFormatProperties( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2783,7 +2886,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pPropertyCount, VkVideoFormatPropertiesKHR* pProperties) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr; @@ -2815,7 +2918,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoProfileInfoStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2823,7 +2926,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pStructureTypeCount, VkStructureType* pStructureTypes) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr; @@ -2849,7 +2952,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoCapabilityStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2857,7 +2960,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pStructureTypeCount, VkStructureType* pStructureTypes) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr; @@ -2883,7 +2986,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): VPAPI_ATTR VkResult vpGetProfileVideoFormatStructureTypes( #ifdef VP_USE_OBJECT - VpCapabilities capabilities, + VpFunctions functions, #endif//VP_USE_OBJECT const VpProfileProperties* pProfile, const char* pBlockName, @@ -2891,7 +2994,7 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True): uint32_t* pStructureTypeCount, VkStructureType* pStructureTypes) { #ifdef VP_USE_OBJECT - (void)capabilities; + (void)functions; #endif//VP_USE_OBJECT const detail::VpVideoProfileDesc* pVideoProfileDesc = nullptr;