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.
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.