From 520163b4b3f3f6e4696a6355f029d9e05d3bb9cf Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 18 Sep 2023 22:24:49 -0600 Subject: icd: Add VkPhysicalDeviceDriverProperties This commit adds support for the VkPhysicalDeviceDriverProperties struct in the output of vkGetPhysicalDeviceProperties2. This is useful for users of Mock ICD wishing to know the version of MockICD used. The driverInfo field is used for this purpose and contains the git branch & tag info data. The use of Git in CMake is how the information is seamlessly gotten and provided to the source code in the form of compile definitions. --- icd/generated/function_definitions.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'icd/generated/function_definitions.h') diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 22dae97e..75620690 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -3008,7 +3008,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, }; - auto *host_image_copy_props = lvl_find_mod_in_chain< VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext); + auto *host_image_copy_props = lvl_find_mod_in_chain(pProperties->pNext); if (host_image_copy_props){ if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; else { @@ -3025,6 +3025,16 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( } } } + + auto *driver_properties = lvl_find_mod_in_chain(pProperties->pNext); + if (driver_properties) { + std::strncpy(driver_properties->driverName, "Vulkan Mock Device", VK_MAX_DRIVER_NAME_SIZE); +#if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) + std::strncpy(driver_properties->driverInfo, "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO, VK_MAX_DRIVER_INFO_SIZE); +#else + std::strncpy(driver_properties->driverInfo, "Branch: --unknown-- Tag Info: --unknown--", VK_MAX_DRIVER_INFO_SIZE); +#endif + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( -- cgit v1.2.3