diff options
author | Dave Airlie <[email protected]> | 2017-11-16 12:02:04 +1000 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-04 10:04:19 -0800 |
commit | 8ff49951c30bf47f29d8ed7c9ea7ab655417391b (patch) | |
tree | b702f446db2080f7f7d08c130265f534586818e8 /src/amd/vulkan | |
parent | ad4c60d6b87eb92191c638bf52ad38e7dd59f627 (diff) |
vulkan/wsi: move swapchain create/destroy to common code
v2 (Jason Ekstrand):
- Rebase
- Alter the names of the helpers to better match the vulkan entrypoints
- Use the helpers in anv
Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_wsi.c | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index e159b6436e0..d00e0281689 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -164,60 +164,34 @@ VkResult radv_CreateSwapchainKHR( VkSwapchainKHR* pSwapchain) { RADV_FROM_HANDLE(radv_device, device, _device); - ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pCreateInfo->surface); - struct wsi_interface *iface = - device->physical_device->wsi_device.wsi[surface->platform]; - struct wsi_swapchain *swapchain; const VkAllocationCallbacks *alloc; if (pAllocator) alloc = pAllocator; else alloc = &device->alloc; - VkResult result = iface->create_swapchain(surface, _device, - &device->physical_device->wsi_device, - device->physical_device->local_fd, - pCreateInfo, - alloc, - &swapchain); - if (result != VK_SUCCESS) - return result; - - if (pAllocator) - swapchain->alloc = *pAllocator; - else - swapchain->alloc = device->alloc; - - for (unsigned i = 0; i < ARRAY_SIZE(swapchain->fences); i++) - swapchain->fences[i] = VK_NULL_HANDLE; - - *pSwapchain = wsi_swapchain_to_handle(swapchain); - return VK_SUCCESS; + return wsi_common_create_swapchain(&device->physical_device->wsi_device, + radv_device_to_handle(device), + device->physical_device->local_fd, + pCreateInfo, + alloc, + pSwapchain); } void radv_DestroySwapchainKHR( VkDevice _device, - VkSwapchainKHR _swapchain, + VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) { RADV_FROM_HANDLE(radv_device, device, _device); - RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain); const VkAllocationCallbacks *alloc; - if (!_swapchain) - return; - 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); - } - - swapchain->destroy(swapchain, alloc); + wsi_common_destroy_swapchain(_device, swapchain, alloc); } VkResult radv_GetSwapchainImagesKHR( |