VK_EXT_vertex_attribute_divisor(3)

# VK_EXT_vertex_attribute_divisor(3) Manual Page

## Name

VK_EXT_vertex_attribute_divisor - device extension

Loading… please wait.

## Registered Extension Number

191

## Revision

3

## Extension and Version Dependencies

- Requires Vulkan 1.0

- Requires `VK_KHR_get_physical_device_properties2`

## Contact

- Vikram Kushwaha vkushwaha

## Other Extension Metadata

Last Modified Date

  2018-08-03

IP Status

  No known IP claims.

Contributors

  - Vikram Kushwaha, NVIDIA

  - Jason Ekstrand, Intel

## Description

This extension allows instance-rate vertex attributes to be repeated for certain number of instances instead of advancing for every instance when instanced rendering is enabled.

## New Structures

- VkVertexInputBindingDivisorDescriptionEXT

- Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

  - VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT

- Extending VkPhysicalDeviceProperties2:

  - VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT

- Extending VkPipelineVertexInputStateCreateInfo:

  - VkPipelineVertexInputDivisorStateCreateInfoEXT

## New Enum Constants

- `VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME`

- `VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION`

- Extending VkStructureType:

  - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT`

  - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT`

  - `VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT`

## Issues

1) What is the effect of a non-zero value for `firstInstance`?

RESOLVED: The Vulkan API should follow the OpenGL convention and offset attribute fetching by `firstInstance` while computing vertex attribute offsets.

2) Should zero be an allowed divisor?

RESOLVED: Yes. A zero divisor means the vertex attribute is repeated for all instances.

## Examples

To create a vertex binding such that the first binding uses instanced rendering and the same attribute is used for every 4 draw instances, an application could use the following set of structures:

        const VkVertexInputBindingDivisorDescriptionEXT divisorDesc =
        {
            0,
            4
        };

        const VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo =
        {
            VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT, // sType
            NULL,                                                             // pNext
            1,                                                                // vertexBindingDivisorCount
            &divisorDesc                                                      // pVertexBindingDivisors
        }

        const VkVertexInputBindingDescription binding =
        {
            0,                                                                // binding
            sizeof(Vertex),                                                   // stride
            VK_VERTEX_INPUT_RATE_INSTANCE                                     // inputRate
        };

        const VkPipelineVertexInputStateCreateInfo viInfo =
        {
            VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO,              // sType
            &divisorInfo,                                                     // pNext
            ...
        };
        //...

## Version History

- Revision 1, 2017-12-04 (Vikram Kushwaha)

  - First Version

- Revision 2, 2018-07-16 (Jason Ekstrand)

  - Adjust the interaction between `divisor` and `firstInstance` to match the OpenGL convention.

  - Disallow divisors of zero.

- Revision 3, 2018-08-03 (Vikram Kushwaha)

  - Allow a zero divisor.

  - Add a physical device features structure to query/enable this feature.

## See Also

VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPipelineVertexInputDivisorStateCreateInfoEXT, VkVertexInputBindingDivisorDescriptionEXT

## 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-2022 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0