# VK_EXT_shader_uniform_buffer_unsized_array(3) Manual Page

## Name

VK_EXT_shader_uniform_buffer_unsized_array - device extension

Loading… please wait.

## Registered Extension Number

643

## Revision

1

## Ratification Status

Ratified

## Extension and Version Dependencies

VK_KHR_get_physical_device_properties2
or
Vulkan Version 1.1

## Contact

- Piers Daniell [GitHub]pdaniell-nv

## Extension Proposal

VK_EXT_shader_uniform_buffer_unsized_array

## Other Extension Metadata

Last Modified Date

  2025-05-28

Contributors

  - Pat Brown, NVIDIA

  - Jeff Bolz, NVIDIA

  - Pranjal Dubey, NVIDIA

## Description

This extension allows the last member of a uniform buffer block to be declared as an unsized array. This capability enables applications to create flexible buffer layouts where the array size can vary based on runtime requirements.

When the last member of a uniform buffer block is declared as an unsized array, the effective array size is inferred at runtime from the size of the buffer object backing the uniform buffer block. Such unsized arrays can be indexed with general integer expressions, but may not be passed as arguments to functions or indexed with negative constant expressions.

This extension leverages existing SPIR-V capabilities, allowing use of `OpTypeRuntimeArray` as the last member of a uniform buffer block structure while prohibiting `OpArrayLength`.

Applications needing to know array sizes at runtime should calculate the length and pass it to shaders via a separate uniform. This calculation can be performed using the formula: max((buffer_object_size - offset_of_array) / stride_of_array, 0), where buffer_object_size is the size of the bound buffer, offset_of_array is the byte offset of the array in the block, and stride_of_array is the byte stride between consecutive array elements.

Uniform buffers have traditionally required explicit sizes for all arrays which limits flexibility. With this extension, developers can create a single shader that adapts to different data set sizes at runtime by binding differently sized buffers.

## New Structures

- Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

  - VkPhysicalDeviceShaderUniformBufferUnsizedArrayFeaturesEXT

## New Enum Constants

- `VK_EXT_SHADER_UNIFORM_BUFFER_UNSIZED_ARRAY_EXTENSION_NAME`

- `VK_EXT_SHADER_UNIFORM_BUFFER_UNSIZED_ARRAY_SPEC_VERSION`

- Extending VkStructureType:

  - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_UNIFORM_BUFFER_UNSIZED_ARRAY_FEATURES_EXT`

## Version History

- Revision 1, 2025-05-28 (Pranjal Dubey)

  - Initial draft

## See Also

No cross-references are available

## Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.

## Copyright

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0