if (found != icd.device_handles.end()) icd.device_handles.erase(found);
}
-//// WSI
+VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t* pToolCount,
+ VkPhysicalDeviceToolPropertiesEXT* pToolProperties) {
+ if (icd.tooling_properties.size() == 0) {
+ return VK_SUCCESS;
+ }
+ if (pToolProperties == nullptr && pToolCount != nullptr) {
+ *pToolCount = static_cast<uint32_t>(icd.tooling_properties.size());
+ } else if (pToolCount != nullptr) {
+ for (size_t i = 0; i < *pToolCount; i++) {
+ if (i >= icd.tooling_properties.size()) {
+ return VK_INCOMPLETE;
+ }
+ pToolProperties[i] = icd.tooling_properties[i];
+ }
+ }
+ return VK_SUCCESS;
+}
+
+//// WSI ////
+
#ifdef VK_USE_PLATFORM_ANDROID_KHR
VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
return TO_VOID_PFN(test_vkGetPhysicalDeviceImageFormatProperties2);
}
}
+ if (icd.supports_tooling_info_ext) {
+ if (string_eq(pName, "vkGetPhysicalDeviceToolPropertiesEXT")) return TO_VOID_PFN(test_vkGetPhysicalDeviceToolPropertiesEXT);
+ }
+
for (auto& func : icd.custom_physical_device_functions) {
if (func.name == pName) {
return TO_VOID_PFN(func.function);
std::vector<VulkanFunction> custom_instance_functions;
std::vector<VulkanFunction> custom_physical_device_functions;
+ // Must explicitely state support for the tooling info extension, that way we can control if vkGetInstanceProcAddr returns a
+ // function pointer for vkGetPhysicalDeviceToolPropertiesEXT
+ bool supports_tooling_info_ext = false;
+ // List of tooling properties that this driver 'supports'
+ std::vector<VkPhysicalDeviceToolPropertiesEXT> tooling_properties;
+
TestICD() {}
~TestICD() {}
EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/").str()));
}
#endif
+
+TEST(ExtensionManual, ToolingProperties) {
+ VkPhysicalDeviceToolPropertiesEXT icd_tool_props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT,
+ nullptr,
+ "FakeICDTool",
+ "version_0_0_0_1.b",
+ VK_TOOL_PURPOSE_VALIDATION_BIT_EXT,
+ "This tool does not exist",
+ "No-Layer"};
+ { // extension
+ SingleICDShim env{TestICDDetails{TEST_ICD_PATH_VERSION_6}};
+ env.get_test_icd().physical_devices.push_back({});
+ env.get_test_icd().supports_tooling_info_ext = true;
+ env.get_test_icd().tooling_properties.push_back(icd_tool_props);
+ env.get_test_icd().physical_devices.back().extensions.push_back({VK_EXT_TOOLING_INFO_EXTENSION_NAME, 0});
+
+ InstWrapper inst{env.vulkan_functions};
+ inst.CheckCreate();
+
+ auto phys_dev = inst.GetPhysDev();
+
+ auto getToolProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceToolPropertiesEXT>(
+ inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceToolPropertiesEXT"));
+ handle_assert_has_value(getToolProperties);
+ uint32_t tool_count = 1;
+ ASSERT_EQ(VK_SUCCESS, getToolProperties(phys_dev, &tool_count, nullptr));
+ ASSERT_EQ(tool_count, 1);
+ VkPhysicalDeviceToolPropertiesEXT props{};
+ ASSERT_EQ(VK_SUCCESS, getToolProperties(phys_dev, &tool_count, &props));
+ ASSERT_EQ(tool_count, 1);
+ string_eq(props.name, icd_tool_props.name);
+ }
+}
\ No newline at end of file