VKCREATEIMAGEVIEW(3)

NAME
vkCreateImageView - Create an image view from an existing image.

C SPECIFICATION

    VkResult vkCreateImageView(
        VkDevice                                    device,
        const VkImageViewCreateInfo*                pCreateInfo,
        const VkAllocationCallbacks*                pAllocator,
        VkImageView*                                pView);

PARAMETERS

device
    Logical device which owns the image.

pCreateInfo
    Specifies properties of the new view.

pView
    Returns the requested object.

DESCRIPTION

vkCreateImageView creates a new view of a source image in a compatible format, allowing casting of image data from one format to another. Image views may be bound into descriptor sets to allow them to be accessed in shaders, or be bound as color attachments. device specifies the device that is to be used to create the new view. pCreateInfo is a pointer to an instance of the VkImageViewCreateInfo structure defining the properties of the new view object. The definition of VkImageViewCreateInfo is:

    typedef struct VkImageViewCreateInfo {
        VkStructureType            sType;
        const void*                pNext;
        VkImageViewCreateFlags     flags;
        VkImage                    image;
        VkImageViewType            viewType;
        VkFormat                   format;
        VkComponentMapping         components;
        VkImageSubresourceRange    subresourceRange;
    } VkImageViewCreateInfo;

The sType member of pCreateInfo should be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO. The image member contains the handle to the parent object of which to create a view. viewType specifies the type of view to be created and should be a member of the VkImageViewType enumeration, the definition of which is:

    typedef enum VkImageViewType {
        VK_IMAGE_VIEW_TYPE_1D = 0,
        VK_IMAGE_VIEW_TYPE_2D = 1,
        VK_IMAGE_VIEW_TYPE_3D = 2,
        VK_IMAGE_VIEW_TYPE_CUBE = 3,
        VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4,
        VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5,
        VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6,
    } VkImageViewType;

The format member of pCreateInfo specifies the image format for the newly created view and should be compatible with the base format of the parent image specified in image. The components member is an instance of the VkComponentMapping structure which defines component ordering for data read from the view. The subresourceRange member of the pCreateInfo specifies the range of the parent resource to be visible through the new view.

The flags member of pCreateInfo is reserved and must be 0.

VALID USAGE

    • device must be a valid VkDevice handle

    • pCreateInfo must be a pointer to a valid VkImageViewCreateInfo structure

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

    • pView must be a pointer to a VkImageView handle

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

SEE ALSO

vkCreateImage, vkCreateBuffer, vkCreateBufferView

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.