C Specification

To determine the amount of memory needed to store all descriptors with a given layout, call:

// Provided by VK_EXT_descriptor_buffer
void vkGetDescriptorSetLayoutSizeEXT(
    VkDevice                                    device,
    VkDescriptorSetLayout                       layout,
    VkDeviceSize*                               pLayoutSizeInBytes);

Parameters

  • device is the logical device that gets the size.

  • layout is the descriptor set layout being queried.

  • pLayoutSizeInBytes is a pointer to VkDeviceSize where the size in bytes will be written.

Description

The size of a descriptor set layout will be at least as large as the sum total of the size of all descriptors in the layout, and may be larger. This size represents the amount of memory that will be required to store all of the descriptors for this layout in memory, when placed according to the layout’s offsets as obtained by vkGetDescriptorSetLayoutBindingOffsetEXT.

If any binding in layout is VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, the returned size includes space for the maximum descriptorCount descriptors as declared for that binding. To compute the required size of a descriptor set with a VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT:

size = offset + descriptorSize × variableDescriptorCount

where offset is obtained by vkGetDescriptorSetLayoutBindingOffsetEXT and descriptorSize is the size of the relevant descriptor as obtained from VkPhysicalDeviceDescriptorBufferPropertiesEXT, and variableDescriptorCount is the equivalent of VkDescriptorSetVariableDescriptorCountAllocateInfo::pDescriptorCounts. For VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK, variableDescriptorCount is the size in bytes for the inline uniform block, and descriptorSize is 1.

If VkPhysicalDeviceDescriptorBufferPropertiesEXT::combinedImageSamplerDescriptorSingleArray is VK_FALSE and the variable descriptor type is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, variableDescriptorCount is always considered to be the upper bound.

Valid Usage
  • VUID-vkGetDescriptorSetLayoutSizeEXT-None-08011
    The descriptorBuffer feature must be enabled

  • VUID-vkGetDescriptorSetLayoutSizeEXT-layout-08012
    layout must have been created with the VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT flag set

Valid Usage (Implicit)
  • VUID-vkGetDescriptorSetLayoutSizeEXT-device-parameter
    device must be a valid VkDevice handle

  • VUID-vkGetDescriptorSetLayoutSizeEXT-layout-parameter
    layout must be a valid VkDescriptorSetLayout handle

  • VUID-vkGetDescriptorSetLayoutSizeEXT-pLayoutSizeInBytes-parameter
    pLayoutSizeInBytes must be a valid pointer to a VkDeviceSize value

  • VUID-vkGetDescriptorSetLayoutSizeEXT-layout-parent
    layout must have been created, allocated, or retrieved from device

See Also

Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2024 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0