VKCREATEDESCRIPTORSE(3)

NAME
vkCreateDescriptorSetLayout - Create a new descriptor set layout.

C SPECIFICATION

    VkResult vkCreateDescriptorSetLayout(
        VkDevice                                    device,
        const VkDescriptorSetLayoutCreateInfo*      pCreateInfo,
        const VkAllocationCallbacks*                pAllocator,
        VkDescriptorSetLayout*                      pSetLayout);

PARAMETERS

device
    The device with which to create the layout object.

pCreateInfo
    Pointer to a structure specifying information to be placed in the object

pSetLayout
    Pointer to a variable which will receive the new handle.

DESCRIPTION

vkCreateDescriptorSetLayout creates a new descriptor set layout usable by the device specified in device using the information contained in the structure pointed to by pCreateInfo. If successful, a handle to the newly created layout object is placed in the variable pointed to by pSetLayout. The description of the layout is specified in pCreateInfo, which is a pointer to an instance of the VkDescriptorSetLayoutCreateInfo structure, the definition of which is:

    typedef struct VkDescriptorSetLayoutCreateInfo {
        VkStructureType                        sType;
        const void*                            pNext;
        VkDescriptorSetLayoutCreateFlags       flags;
        uint32_t                               bindingCount;
        const VkDescriptorSetLayoutBinding*    pBindings;
    } VkDescriptorSetLayoutCreateInfo;

The bindingCount member of pCreateInfo specifies the number of bindings contained in the set. This is the number of elements in the array pointed to by pBinding, which is an array of VkDescriptorSetLayoutBinding structures. The definition of VkDescriptorSetLayoutBinding is:

    typedef struct VkDescriptorSetLayoutBinding {
        uint32_t              binding;
        VkDescriptorType      descriptorType;
        uint32_t              descriptorCount;
        VkShaderStageFlags    stageFlags;
        const VkSampler*      pImmutableSamplers;
    } VkDescriptorSetLayoutBinding;

Each element of the pBinding array specifies a descriptor or an array of descriptors to be included in the set layout. descriptorType contains the descriptor type and must be one of the VkDescriptorType enumerants, the complete list of which is:

    typedef enum VkDescriptorType {
        VK_DESCRIPTOR_TYPE_SAMPLER = 0,
        VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1,
        VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2,
        VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3,
        VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4,
        VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5,
        VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6,
        VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7,
        VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8,
        VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9,
        VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10,
    } VkDescriptorType;

The stageFlags member specifies which pipeline shader stages may access the resource. This is a bitwise combination of the VkShaderStageFlags enumerant, the list of which is:

    typedef enum VkShaderStageFlagBits {
        VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
        VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
        VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
        VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
        VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
        VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
        VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
        VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
    } VkShaderStageFlagBits;

If a shader stage is not included in stageFlags, then the resource may not be accessed from that stage within any pipeline using the set layout.

If descriptorType member specifies a VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER type descriptor, then the pImmutableSamplers member may be used to initialize a set of immutable samplers. Immutable samplers are permanently bound into the set layout; later binding a sampler into an immutable sampler slot in a descriptor set is not allowed. If pImmutableSamplers is not NULL, then it is considered to be a pointer to an array of arraySize sampler handles that will be consumed by the set layout and used for the corresponding binding. If pImmutableSamplers is NULL, then the sampler slots are dynamic and sampler handles must be bound into descriptor sets using this layout. If descriptorType is not one of these descriptor types, then pImmutableSamplers is ignored.

VALID USAGE

    • device must be a valid VkDevice handle

    • pCreateInfo must be a pointer to a valid VkDescriptorSetLayoutCreateInfo structure

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

    • pSetLayout must be a pointer to a VkDescriptorSetLayout 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

vkAllocateDescriptorSets, vkFreeDescriptorSets, vkCreateDescriptorPool

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.