Skip to content

Commit bcf860b

Browse files
committed
Fix bug in wrap/unwrap physical device object
The Vulkan loader wraps VKPhysicalDevice into a loader_physical_device_tramp structure and returns it to the application. This is done by the function setup_loader_tramp_phys_devs. When the application passes a VKPhysicalDevice to the Vulkan loader, it is internally treated as a pointer of loader_physical_device_tramp. The loader then extracts the actual VKPhysicalDevice and forwards it to the ICD driver. However, there is an issue in the function terminator_CreateDevice. Instead of converting the VKPhysicalDevice back into a loader_physical_device_tramp, it incorrectly converts it to a loader_physical_device_term. This mismatch causes a crash in Vulkan CTS during the test case 'dEQP-VK.api.object_management.single.device_group'.
1 parent 0508dee commit bcf860b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

loader/loader.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5915,10 +5915,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical
59155915

59165916
// Before calling down, replace the incoming physical device values (which are really loader terminator
59175917
// physical devices) with the ICDs physical device values.
5918-
struct loader_physical_device_term *cur_term;
5918+
struct loader_physical_device_tramp *cur_tramp;
59195919
for (uint32_t phys_dev = 0; phys_dev < cur_struct->physicalDeviceCount; phys_dev++) {
5920-
cur_term = (struct loader_physical_device_term *)cur_struct->pPhysicalDevices[phys_dev];
5921-
phys_dev_array[phys_dev] = cur_term->phys_dev;
5920+
cur_tramp = (struct loader_physical_device_tramp *)cur_struct->pPhysicalDevices[phys_dev];
5921+
phys_dev_array[phys_dev] = cur_tramp->phys_dev;
59225922
}
59235923
temp_struct->pPhysicalDevices = phys_dev_array;
59245924

0 commit comments

Comments
 (0)