radv: fix wsi porting regression in swapchain destroy.
authorDave Airlie <airlied@redhat.com>
Wed, 19 Oct 2016 03:53:55 +0000 (13:53 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 19 Oct 2016 03:54:49 +0000 (13:54 +1000)
The code in anv is right, there's a pending patch to fix this up
different, but I'll sync the code for now.

src/amd/vulkan/radv_wsi.c

index ba5c37b..948be63 100644 (file)
@@ -280,18 +280,25 @@ VkResult radv_CreateSwapchainKHR(
 }
 
 void radv_DestroySwapchainKHR(
-       VkDevice                                     device,
+       VkDevice                                     _device,
        VkSwapchainKHR                               _swapchain,
        const VkAllocationCallbacks*                 pAllocator)
 {
+       RADV_FROM_HANDLE(radv_device, device, _device);
        RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
+       const VkAllocationCallbacks *alloc;
+
+       if (pAllocator)
+               alloc = pAllocator;
+       else
+               alloc = &device->alloc;
 
        for (unsigned i = 0; i < ARRAY_SIZE(swapchain->fences); i++) {
                if (swapchain->fences[i] != VK_NULL_HANDLE)
-                       radv_DestroyFence(device, swapchain->fences[i], pAllocator);
+                       radv_DestroyFence(_device, swapchain->fences[i], pAllocator);
        }
 
-       swapchain->destroy(swapchain, pAllocator);
+       swapchain->destroy(swapchain, alloc);
 }
 
 VkResult radv_GetSwapchainImagesKHR(