summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-11-16 12:02:04 +1000
committerJason Ekstrand <[email protected]>2017-12-04 10:04:19 -0800
commit8ff49951c30bf47f29d8ed7c9ea7ab655417391b (patch)
treeb702f446db2080f7f7d08c130265f534586818e8 /src/intel/vulkan
parentad4c60d6b87eb92191c638bf52ad38e7dd59f627 (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/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_wsi.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index eed378cc74f..62368a10a06 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -193,57 +193,32 @@ VkResult anv_CreateSwapchainKHR(
VkSwapchainKHR* pSwapchain)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pCreateInfo->surface);
- struct wsi_interface *iface =
- device->instance->physicalDevice.wsi_device.wsi[surface->platform];
- struct wsi_swapchain *swapchain;
+ struct wsi_device *wsi_device = &device->instance->physicalDevice.wsi_device;
const VkAllocationCallbacks *alloc;
if (pAllocator)
alloc = pAllocator;
else
alloc = &device->alloc;
- VkResult result = iface->create_swapchain(surface, _device,
- &device->instance->physicalDevice.wsi_device,
- device->instance->physicalDevice.local_fd,
- pCreateInfo,
- alloc,
- &swapchain);
- if (result != VK_SUCCESS)
- return result;
-
- swapchain->alloc = *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(wsi_device, _device, device->fd,
+ pCreateInfo, alloc, pSwapchain);
}
void anv_DestroySwapchainKHR(
VkDevice _device,
- VkSwapchainKHR _swapchain,
+ VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- ANV_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)
- anv_DestroyFence(_device, swapchain->fences[i], pAllocator);
- }
- swapchain->destroy(swapchain, alloc);
+ wsi_common_destroy_swapchain(_device, swapchain, alloc);
}
VkResult anv_GetSwapchainImagesKHR(