aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2023-09-18 22:24:49 -0600
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-09-22 16:30:39 -0600
commit520163b4b3f3f6e4696a6355f029d9e05d3bb9cf (patch)
treed9c62afd9ec3d3e9c4dadc08388c7f4200383f78 /scripts
parentc92c1e0654045eccca6a7f2559102d5264ee938f (diff)
downloadusermoji-520163b4b3f3f6e4696a6355f029d9e05d3bb9cf.tar.xz
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mock_icd_generator.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 6eda0e2e..3de3e540 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -603,7 +603,7 @@ CUSTOM_C_INTERCEPTS = {
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<VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext);
if (host_image_copy_props){
if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts;
else {
@@ -620,6 +620,16 @@ CUSTOM_C_INTERCEPTS = {
}
}
}
+
+ auto *driver_properties = lvl_find_mod_in_chain<VkPhysicalDeviceDriverProperties>(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
+ }
''',
'vkGetPhysicalDeviceExternalSemaphoreProperties':'''
// Hard code support for all handle types and features
@@ -1224,6 +1234,7 @@ class MockICDOutputGenerator(OutputGenerator):
break
write('#pragma once\n',file=self.outFile)
write('#include <stdint.h>',file=self.outFile)
+ write('#include <cstring>',file=self.outFile)
write('#include <string>',file=self.outFile)
write('#include <unordered_map>',file=self.outFile)
write('#include <vulkan/vulkan.h>',file=self.outFile)