@@ -390,39 +390,34 @@ TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupport) {
390390 }
391391}
392392
393- // Add unknown functions to driver 0, and try to use them on driver 1.
393+ // Add unknown functions to driver 0, and try to use them on driver 1. Needs TestICD to implement the unknown function so that it
394+ // can validate the passed in VkPhysicalDevice
394395TEST (UnknownFunctionDeathTests, PhysicalDeviceFunctionErrorPath) {
395396 FrameworkEnvironment env{};
396397 auto & driver_0 = env.add_icd (TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA );
397- auto & driver_1 = env.add_icd (TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA );
398- std::vector<std::string> function_names;
399- add_function_names (function_names, 1 );
398+ auto & driver_1 = env.add_icd (TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA ).set_supports_internal_function (true );
400399
401400 // used to identify the GPUs
402- auto & test_physical_driver_0 = driver_0.add_and_get_physical_device (" physical_device_0" );
403- test_physical_driver_0.properties .deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU ;
404- auto & test_physical_driver_1 = driver_1.add_and_get_physical_device (" physical_device_1" );
405- test_physical_driver_1.properties .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU ;
406- function_names.push_back (std::string (" vkNotIntRealFuncTEST_0" ));
407-
408- custom_physical_device_functions funcs{};
409- test_physical_driver_0.custom_physical_device_functions .push_back (
410- VulkanFunction{function_names.back (), to_vkVoidFunction (funcs.func_zero )});
401+ driver_0.add_and_get_physical_device (" physical_device_0" ).properties .deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU ;
402+ driver_1.add_and_get_physical_device (" physical_device_1" ).properties .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU ;
411403
412404 InstWrapper inst{env.vulkan_functions };
413405 inst.CheckCreate ();
414406
415407 auto phys_devs = inst.GetPhysDevs (2 );
416- VkPhysicalDevice phys_dev_to_use = phys_devs[1 ];
417408 VkPhysicalDeviceProperties props{};
409+ env.vulkan_functions .vkGetPhysicalDeviceProperties (phys_devs[0 ], &props);
410+ ASSERT_EQ (props.deviceType , VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU );
411+
418412 env.vulkan_functions .vkGetPhysicalDeviceProperties (phys_devs[1 ], &props);
419- if (props.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU ) phys_dev_to_use = phys_devs[0 ];
420- // use the wrong GPU to query the functions, should get 5 errors
413+ ASSERT_EQ (props.deviceType , VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU );
421414
422- decltype (custom_physical_device_functions::func_zero)* returned_func_i =
423- env.vulkan_functions .load (inst.inst , function_names. at ( 0 ). c_str () );
415+ // GPU that supports the unknown function is enumerated first (gpus are enumerated in reverse order)
416+ PFN_test_icd_internal_function returned_func_i = env.vulkan_functions .load (inst.inst , TEST_ICD_INTERNAL_FUNCTION_NAME_STRING );
424417 ASSERT_NE (returned_func_i, nullptr );
425- ASSERT_DEATH (returned_func_i (phys_dev_to_use, 0 ), " Function vkNotIntRealFuncTEST_0 not supported for this physical device" );
418+ ASSERT_EQ (returned_func_i (phys_devs[0 ], 0 , 1 , 2 .2f ), VK_SUCCESS );
419+ ASSERT_DEATH (returned_func_i (phys_devs[1 ], 0 , 1 , 2 .2f ),
420+ " Function " TEST_ICD_INTERNAL_FUNCTION_NAME_STRING " not supported for this physical device" );
426421}
427422
428423TEST (UnknownFunction, PhysicalDeviceFunctionWithImplicitLayerImplementation) {
0 commit comments