VK_KHR_shader_draw_parameters(3)

# VK_KHR_shader_draw_parameters(3) Manual Page

## Name

VK_KHR_shader_draw_parameters - device extension

Loading… please wait.

## Registered Extension Number

64

## Revision

1

## Extension and Version Dependencies

- Requires Vulkan 1.0

## Deprecation state

- Promoted to Vulkan 1.1

### Other Extension Metadata

Last Modified Date

  2017-09-05

IP Status

  No known IP claims.

Interactions and External Dependencies

  - This extension requires `SPV_KHR_shader_draw_parameters`

  - This extension provides API support for `GL_ARB_shader_draw_parameters`

  - Promoted to Vulkan 1.1 Core

Contributors

  - Daniel Koch, NVIDIA Corporation

  - Jeff Bolz, NVIDIA

  - Daniel Rakos, AMD

  - Jan-Harald Fredriksen, ARM

  - John Kessenich, Google

  - Stuart Smith, IMG

### Description

This extension adds support for the following SPIR-V extension in Vulkan:

- `SPV_KHR_shader_draw_parameters`

The extension provides access to three additional built-in shader variables in Vulkan:

- `BaseInstance`, which contains the `firstInstance` parameter passed to draw commands,

- `BaseVertex`, which contains the `firstVertex` or `vertexOffset` parameter passed to draw commands, and

- `DrawIndex`, which contains the index of the draw call currently being processed from an indirect draw call.

When using GLSL source-based shader languages, the following variables from `GL_ARB_shader_draw_parameters` can map to these SPIR-V built-in decorations:

- `in int gl_BaseInstanceARB;` → `BaseInstance`,

- `in int gl_BaseVertexARB;` → `BaseVertex`, and

- `in int gl_DrawIDARB;` → `DrawIndex`.

### Promotion to Vulkan 1.1

All functionality in this extension is included in core Vulkan 1.1, however a feature bit was added to distinguish whether it is actually available or not.

### New Enum Constants

- `VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME`

- `VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION`

### New Built-In Variables

- `BaseInstance`

- `BaseVertex`

- `DrawIndex`

### New SPIR-V Capabilities

- DrawParameters

### Issues

1) Is this the same functionality as `GL_ARB_shader_draw_parameters`?

RESOLVED: It’s actually a superset as it also adds in support for arrayed drawing commands.

In GL for `GL_ARB_shader_draw_parameters`, `gl_BaseVertexARB` holds the integer value passed to the parameter to the command that resulted in the current shader invocation. In the case where the command has no `baseVertex` parameter, the value of `gl_BaseVertexARB` is zero. This means that `gl_BaseVertexARB` = `baseVertex` (for `glDrawElements` commands with `baseVertex`) or 0. In particular there are no `glDrawArrays` commands that take a `baseVertex` parameter.

Now in Vulkan, we have `BaseVertex` = `vertexOffset` (for indexed drawing commands) or `firstVertex` (for arrayed drawing commands), and so Vulkan’s version is really a superset of GL functionality.

### Version History

- Revision 1, 2016-10-05 (Daniel Koch)

  - Internal revisions

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

SPDX-License-Identifier: CC-BY-4.0