1// Copyright (c) 2016-2018 Khronos Group. This work is licensed under a 2// Creative Commons Attribution 4.0 International License; see 3// http://creativecommons.org/licenses/by/4.0/ 4 5include::meta/VK_KHR_shader_draw_parameters.txt[] 6 7*Last Modified Date*:: 8 2017-09-05 9*IP Status*:: 10 No known IP claims. 11*Interactions and External Dependencies*:: 12 - Requires the 13 https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_shader_draw_parameters.html[+SPV_KHR_shader_draw_parameters+] 14 SPIR-V extension. 15 - Requires 16 https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shader_draw_parameters.txt[+GL_ARB_shader_draw_parameters+] 17 for GLSL source languages. 18 - Promoted to Vulkan 1.1 Core 19*Contributors*:: 20 - Daniel Koch, NVIDIA Corporation 21 - Jeff Bolz, NVIDIA 22 - Daniel Rakos, AMD 23 - Jan-Harald Fredriksen, ARM 24 - John Kessenich, Google 25 - Stuart Smith, IMG 26 27This extension adds support for the following SPIR-V extension in Vulkan: 28 29 * +SPV_KHR_shader_draw_parameters+ 30 31The extension provides access to three additional built-in shader variables 32in Vulkan: 33 34 * code:BaseInstance, which contains the pname:firstInstance parameter 35 passed to draw commands, 36 * code:BaseVertex, which contains the pname:firstVertex/pname:vertexOffset 37 parameter passed to draw commands, and 38 * code:DrawIndex, which contains the index of the draw call currently 39 being processed from an indirect draw call. 40 41When using GLSL source-based shader languages, the following variables from 42+GL_ARB_shader_draw_parameters+ can map to these SPIR-V built-in 43decorations: 44 45 * `in int gl_BaseInstanceARB;` -> code:BaseInstance, 46 * `in int gl_BaseVertexARB;` -> code:BaseVertex, and 47 * `in int gl_DrawIDARB;` -> code:DrawIndex. 48 49=== New Object Types 50 51None. 52 53=== New Enum Constants 54 55None. 56 57=== New Enums 58 59None. 60 61=== New Structures 62 63None. 64 65=== New Functions 66 67None. 68 69=== New Built-In Variables 70 71 * <<interfaces-builtin-variables-baseinstance,code:BaseInstance>> 72 * <<interfaces-builtin-variables-basevertex,code:BaseVertex>> 73 * <<interfaces-builtin-variables-drawindex,code:DrawIndex>> 74 75=== New SPIR-V Capabilities 76 77 * <<spirvenv-capabilities,DrawParameters>> 78 79=== Promotion to Vulkan 1.1 80 81All functionality in this extension is included in core Vulkan 1.1, however 82a <<features-features-shaderDrawParameters,feature bit was added>> to 83distinguish whether it's actually available or not. 84 85=== Issues 86 871) Is this the same functionality as +GL_ARB_shader_draw_parameters+? 88 89*RESOLVED*: It's actually a superset as it also adds in support for arrayed 90drawing commands. 91 92In GL for +GL_ARB_shader_draw_parameters+, code:gl_BaseVertexARB holds the 93integer value passed to the parameter to the command that resulted in the 94current shader invocation. 95In the case where the command has no code:baseVertex parameter, the value of 96code:gl_BaseVertexARB is zero. 97This means that code:gl_BaseVertexARB = code:baseVertex (for 98code:glDrawElements commands with code:baseVertex) or 0. 99In particular there are no code:glDrawArrays commands that take a 100code:baseVertex parameter. 101 102Now in Vulkan, we have code:BaseVertex = pname:vertexOffset (for indexed 103drawing commands) or pname:firstVertex (for arrayed drawing commands), and 104so Vulkan's version is really a superset of GL functionality. 105 106=== Version History 107 108 * Revision 1, 2016-10-05 (Daniel Koch) 109 - Internal revisions 110