VkBufferViewCreateInfo(3)

# VkBufferViewCreateInfo(3) Manual Page

## Name

VkBufferViewCreateInfo - Structure specifying parameters of a newly created buffer view

## C Specification

The `VkBufferViewCreateInfo` structure is defined as:

    typedef struct VkBufferViewCreateInfo {
        VkStructureType            sType;
        const void*                pNext;
        VkBufferViewCreateFlags    flags;
        VkBuffer                   buffer;
        VkFormat                   format;
        VkDeviceSize               offset;
        VkDeviceSize               range;
    } VkBufferViewCreateInfo;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `flags` is reserved for future use.

- `buffer` is a VkBuffer on which the view will be created.

- `format` is a VkFormat describing the format of the data elements in the buffer.

- `offset` is an offset in bytes from the base address of the buffer. Accesses to the buffer view from shaders use addressing that is relative to this starting offset.

- `range` is a size in bytes of the buffer view. If `range` is equal to `VK_WHOLE_SIZE`, the range from `offset` to the end of the buffer is used. If `VK_WHOLE_SIZE` is used and the remaining size of the buffer is not a multiple of the texel block size of `format`, the nearest smaller multiple is used.

## Description

Valid Usage

- `offset` must be less than the size of `buffer`

- If the texelBufferAlignment feature is not enabled, `offset` must be a multiple of `VkPhysicalDeviceLimits`::`minTexelBufferOffsetAlignment`

- If `range` is not equal to `VK_WHOLE_SIZE`, `range` must be greater than `0`

- If `range` is not equal to `VK_WHOLE_SIZE`, `range` must be an integer multiple of the texel block size of `format`

- If `range` is not equal to `VK_WHOLE_SIZE`, `range` divided by the texel block size of `format`, multiplied by the number of texels per texel block for that format (as defined in the Compatible Formats table), must be less than or equal to `VkPhysicalDeviceLimits`::`maxTexelBufferElements`

- If `range` is not equal to `VK_WHOLE_SIZE`, the sum of `offset` and `range` must be less than or equal to the size of `buffer`

- `buffer` must have been created with a `usage` value containing at least one of `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT` or `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT`

- If `buffer` was created with `usage` containing `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT`, `format` must be supported for uniform texel buffers, as specified by the `VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT` flag in `VkFormatProperties`::`bufferFeatures` returned by `vkGetPhysicalDeviceFormatProperties`

- If `buffer` was created with `usage` containing `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT`, `format` must be supported for storage texel buffers, as specified by the `VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT` flag in `VkFormatProperties`::`bufferFeatures` returned by `vkGetPhysicalDeviceFormatProperties`

- If `buffer` is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

- If the texelBufferAlignment feature is enabled and if `buffer` was created with `usage` containing `VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT`, `offset` must be a multiple of the lesser of VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::`storageTexelBufferOffsetAlignmentBytes` or, if VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::`storageTexelBufferOffsetSingleTexelAlignment` is `VK_TRUE`, the size of a texel of the requested `format`. If the size of a texel is a multiple of three bytes, then the size of a single component of `format` is used instead

- If the texelBufferAlignment feature is enabled and if `buffer` was created with `usage` containing `VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT`, `offset` must be a multiple of the lesser of VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::`uniformTexelBufferOffsetAlignmentBytes` or, if VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::`uniformTexelBufferOffsetSingleTexelAlignment` is `VK_TRUE`, the size of a texel of the requested `format`. If the size of a texel is a multiple of three bytes, then the size of a single component of `format` is used instead

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO`

- `pNext` must be `NULL`

- `flags` must be `0`

- `buffer` must be a valid `VkBuffer` handle

- `format` must be a valid VkFormat value

## See Also

VkBuffer, VkBufferViewCreateFlags, `VkDeviceSize`, VkFormat, VkStructureType, vkCreateBufferView

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

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.