diff options
Diffstat (limited to 'loader/wsi.c')
-rw-r--r-- | loader/wsi.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/loader/wsi.c b/loader/wsi.c index e44c37fbf..a1dbe0f40 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -457,25 +457,27 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, co uint32_t icd_index = 0; struct loader_device *dev; struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; - if (NULL != icd_surface->real_icd_surfaces) { - if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { - // We found the ICD, and there is an ICD KHR surface - // associated with it, so copy the CreateInfo struct - // and point it at the ICD's surface. - VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); - if (NULL == pCreateCopy) { - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); - pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; - return icd_term->dispatch.CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain); + if (NULL == icd_term || NULL == dev || NULL == dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSwapchainKHR: Invalid device [VUID-vkCreateSwapchainKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; + if (NULL != icd_surface->real_icd_surfaces) { + if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { + // We found the ICD, and there is an ICD KHR surface + // associated with it, so copy the CreateInfo struct + // and point it at the ICD's surface. + VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); + if (NULL == pCreateCopy) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } + memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); + pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; + return dev->loader_dispatch.core_dispatch.CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain); } - return icd_term->dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } - return VK_SUCCESS; + return dev->loader_dispatch.core_dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } // This is the trampoline entrypoint for DestroySwapchainKHR @@ -2164,15 +2166,18 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR(V uint32_t icd_index = 0; struct loader_device *dev; struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { - return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, icd_surface->real_icd_surfaces[icd_index], - pModes); - } - return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); + if (NULL == icd_term || NULL == dev || NULL == dev->loader_dispatch.core_dispatch.GetDeviceGroupSurfacePresentModesKHR) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetDeviceGroupSurfacePresentModesKHR: Invalid device " + "[VUID-vkGetDeviceGroupSurfacePresentModesKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ } - return VK_SUCCESS; + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { + return dev->loader_dispatch.core_dispatch.GetDeviceGroupSurfacePresentModesKHR( + device, icd_surface->real_icd_surfaces[icd_index], pModes); + } + return dev->loader_dispatch.core_dispatch.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); } LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, |