VKCREATESWAPCHAINKHR(3)

NAME
vkCreateSwapchainKHR - create a swapchain.

C SPECIFICATION

    VkResult vkCreateSwapchainKHR(
        VkDevice                                    device,
        const VkSwapchainCreateInfoKHR*             pCreateInfo,
        const VkAllocationCallbacks*                pAllocator,
        VkSwapchainKHR*                             pSwapchain);

PARAMETERS

device
    The VkDevice to associate the swapchain.

pCreateInfo
    A pointer to an instance of the VkSwapchainCreateInfoKHR structure containing the parameters affecting the creation of the swapchain object.

pAllocator
    The allocator used for host memory allocated for the surface object.

pSwapchain
    The resulting swapchain.

DESCRIPTION

vkCreateSwapchainKHR creates a swapchain.

pCreateInfo is an instance of the VkSwapchainCreateInfoKHR structure, the definition of which is:

    typedef struct VkSwapchainCreateInfoKHR {
        VkStructureType                  sType;
        const void*                      pNext;
        VkSwapchainCreateFlagsKHR        flags;
        VkSurfaceKHR                     surface;
        uint32_t                         minImageCount;
        VkFormat                         imageFormat;
        VkColorSpaceKHR                  imageColorSpace;
        VkExtent2D                       imageExtent;
        uint32_t                         imageArrayLayers;
        VkImageUsageFlags                imageUsage;
        VkSharingMode                    imageSharingMode;
        uint32_t                         queueFamilyIndexCount;
        const uint32_t*                  pQueueFamilyIndices;
        VkSurfaceTransformFlagBitsKHR    preTransform;
        VkCompositeAlphaFlagBitsKHR      compositeAlpha;
        VkPresentModeKHR                 presentMode;
        VkBool32                         clipped;
        VkSwapchainKHR                   oldSwapchain;
    } VkSwapchainCreateInfoKHR;

VALID USAGE

    • device must be a valid VkDevice handle

    • pCreateInfo must be a pointer to a valid VkSwapchainCreateInfoKHR structure

    • If pAllocator is not NULL, pAllocator must be a pointer to a valid VkAllocationCallbacks structure

    • pSwapchain must be a pointer to a VkSwapchainKHR handle

HOST SYNCHRONIZATION

    • Host access to pCreateInfo.surface must be externally synchronized

    • Host access to pCreateInfo.oldSwapchain must be externally synchronized

RETURN CODES

On success, this command returns

        • VK_SUCCESS

On failure, this command returns

        • VK_ERROR_OUT_OF_HOST_MEMORY

        • VK_ERROR_OUT_OF_DEVICE_MEMORY

        • VK_ERROR_DEVICE_LOST

        • VK_ERROR_SURFACE_LOST_KHR

        • VK_ERROR_NATIVE_WINDOW_IN_USE_KHR

SEE ALSO

vkCreateSharedSwapchainsKHR, vkDestroySwapchainKHR, vkGetSwapchainImagesKHR, vkAcquireNextImageKHR, vkQueuePresentKHR

COPYRIGHT

Copyright © 2014-2016 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

AUTHOR

Khronos Group
    Author.