/ appendices / VK_EXT_vertex_attribute_divisor.txt
VK_EXT_vertex_attribute_divisor.txt
1 include::meta/VK_EXT_vertex_attribute_divisor.txt[] 2 3 *Last Modified Date*:: 4 2018-08-03 5 *IP Status*:: 6 No known IP claims. 7 *Contributors*:: 8 - Vikram Kushwaha, NVIDIA 9 - Jason Ekstrand, Intel 10 11 This extension allows instance-rate vertex attributes to be repeated for 12 certain number of instances instead of advancing for every instance when 13 instanced rendering is enabled. 14 15 === New Object Types 16 17 None. 18 19 === New Enum Constants 20 21 Extending elink:VkStructureType: 22 23 ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT 24 ** ename:VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT 25 ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT 26 27 === New Enums 28 29 None. 30 31 === New Structures 32 33 * Extending slink:VkPipelineVertexInputStateCreateInfo: 34 ** slink:VkPipelineVertexInputDivisorStateCreateInfoEXT 35 * slink:VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT 36 * slink:VkVertexInputBindingDivisorDescriptionEXT 37 * Extending slink:VkPhysicalDeviceFeatures2: 38 ** slink:VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT 39 40 === New Functions 41 42 None. 43 44 === Issues 45 46 1) What is the effect of a non-zero value for pname:firstInstance? 47 48 *RESOLVED*: The Vulkan API should follow the OpenGL convention and offset 49 attribute fetching by pname:firstInstance while computing vertex attribute 50 offsets. 51 52 2) Should zero be an allowed divisor? 53 54 *RESOLVED*: Yes. 55 A zero divisor means the vertex attribute is repeated for all instances. 56 57 58 === Examples 59 60 To create a vertex binding such that the first binding uses instanced 61 rendering and the same attribute is used for every 4 draw instances, an 62 application could use the following set of structures: 63 64 65 [source,c++] 66 ---------------------------------------- 67 68 const VkVertexInputBindingDivisorDescriptionEXT divisorDesc = 69 { 70 0, 71 4 72 }; 73 74 const VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo = 75 { 76 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT, // sType 77 NULL, // pNext 78 1, // vertexBindingDivisorCount 79 &divisorDesc // pVertexBindingDivisors 80 } 81 82 const VkVertexInputBindingDescription binding = 83 { 84 0, // binding 85 sizeof(Vertex), // stride 86 VK_VERTEX_INPUT_RATE_INSTANCE // inputRate 87 }; 88 89 const VkPipelineVertexInputStateCreateInfo viInfo = 90 { 91 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO, // sType 92 &divisorInfo, // pNext 93 ... 94 }; 95 //... 96 ---------------------------------------- 97 98 === Version History 99 100 * Revision 1, 2017-12-04 (Vikram Kushwaha) 101 - First Version 102 * Revision 2, 2018-07-16 (Jason Ekstrand) 103 - Adjust the interaction between pname:divisor and pname:firstInstance 104 to match the OpenGL convention. 105 - Disallow divisors of zero. 106 * Revision 3, 2018-08-03 (Vikram Kushwaha) 107 - Allow a zero divisor. 108 - Add a physical device features structure to query/enable this feature.