VkDynamicState(3)

# VkDynamicState(3) Manual Page

## Name

VkDynamicState - Indicate which dynamic state is taken from dynamic state commands

Loading… please wait.

## C Specification

The source of different pieces of dynamic state is specified by the VkPipelineDynamicStateCreateInfo::`pDynamicStates` property of the currently active pipeline, each of whose elements must be one of the values:

    // Provided by VK_VERSION_1_0
    typedef enum VkDynamicState {
        VK_DYNAMIC_STATE_VIEWPORT = 0,
        VK_DYNAMIC_STATE_SCISSOR = 1,
        VK_DYNAMIC_STATE_LINE_WIDTH = 2,
        VK_DYNAMIC_STATE_DEPTH_BIAS = 3,
        VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
        VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
        VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
        VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
        VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
      // Provided by VK_NV_clip_space_w_scaling
        VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000,
      // Provided by VK_EXT_discard_rectangles
        VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000,
      // Provided by VK_EXT_sample_locations
        VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000,
      // Provided by VK_NV_shading_rate_image
        VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004,
      // Provided by VK_NV_shading_rate_image
        VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006,
      // Provided by VK_NV_scissor_exclusive
        VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001,
      // Provided by VK_EXT_line_rasterization
        VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010,
      // Provided by VK_EXT_extended_dynamic_state
        VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011,
    } VkDynamicState;

## Description

- `VK_DYNAMIC_STATE_VIEWPORT` specifies that the `pViewports` state in VkPipelineViewportStateCreateInfo will be ignored and must be set dynamically with vkCmdSetViewport before any draw commands. The number of viewports used by a pipeline is still specified by the `viewportCount` member of VkPipelineViewportStateCreateInfo.

- `VK_DYNAMIC_STATE_SCISSOR` specifies that the `pScissors` state in VkPipelineViewportStateCreateInfo will be ignored and must be set dynamically with vkCmdSetScissor before any draw commands. The number of scissor rectangles used by a pipeline is still specified by the `scissorCount` member of VkPipelineViewportStateCreateInfo.

- `VK_DYNAMIC_STATE_LINE_WIDTH` specifies that the `lineWidth` state in VkPipelineRasterizationStateCreateInfo will be ignored and must be set dynamically with vkCmdSetLineWidth before any draw commands that generate line primitives for the rasterizer.

- `VK_DYNAMIC_STATE_DEPTH_BIAS` specifies that the `depthBiasConstantFactor`, `depthBiasClamp` and `depthBiasSlopeFactor` states in VkPipelineRasterizationStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthBias before any draws are performed with `depthBiasEnable` in VkPipelineRasterizationStateCreateInfo set to `VK_TRUE`.

- `VK_DYNAMIC_STATE_BLEND_CONSTANTS` specifies that the `blendConstants` state in VkPipelineColorBlendStateCreateInfo will be ignored and must be set dynamically with vkCmdSetBlendConstants before any draws are performed with a pipeline state with `VkPipelineColorBlendAttachmentState` member `blendEnable` set to `VK_TRUE` and any of the blend functions using a constant blend color.

- `VK_DYNAMIC_STATE_DEPTH_BOUNDS` specifies that the `minDepthBounds` and `maxDepthBounds` states of VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthBounds before any draws are performed with a pipeline state with VkPipelineDepthStencilStateCreateInfo member `depthBoundsTestEnable` set to `VK_TRUE`.

- `VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK` specifies that the `compareMask` state in VkPipelineDepthStencilStateCreateInfo for both `front` and `back` will be ignored and must be set dynamically with vkCmdSetStencilCompareMask before any draws are performed with a pipeline state with VkPipelineDepthStencilStateCreateInfo member `stencilTestEnable` set to `VK_TRUE`

- `VK_DYNAMIC_STATE_STENCIL_WRITE_MASK` specifies that the `writeMask` state in VkPipelineDepthStencilStateCreateInfo for both `front` and `back` will be ignored and must be set dynamically with vkCmdSetStencilWriteMask before any draws are performed with a pipeline state with VkPipelineDepthStencilStateCreateInfo member `stencilTestEnable` set to `VK_TRUE`

- `VK_DYNAMIC_STATE_STENCIL_REFERENCE` specifies that the `reference` state in VkPipelineDepthStencilStateCreateInfo for both `front` and `back` will be ignored and must be set dynamically with vkCmdSetStencilReference before any draws are performed with a pipeline state with VkPipelineDepthStencilStateCreateInfo member `stencilTestEnable` set to `VK_TRUE`

- `VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV` specifies that the `pViewportScalings` state in VkPipelineViewportWScalingStateCreateInfoNV will be ignored and must be set dynamically with vkCmdSetViewportWScalingNV before any draws are performed with a pipeline state with VkPipelineViewportWScalingStateCreateInfoNV member `viewportScalingEnable` set to `VK_TRUE`

- `VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT` specifies that the `pDiscardRectangles` state in VkPipelineDiscardRectangleStateCreateInfoEXT will be ignored and must be set dynamically with vkCmdSetDiscardRectangleEXT before any draw or clear commands. The VkDiscardRectangleModeEXT and the number of active discard rectangles is still specified by the `discardRectangleMode` and `discardRectangleCount` members of VkPipelineDiscardRectangleStateCreateInfoEXT.

- `VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT` specifies that the `sampleLocationsInfo` state in VkPipelineSampleLocationsStateCreateInfoEXT will be ignored and must be set dynamically with vkCmdSetSampleLocationsEXT before any draw or clear commands. Enabling custom sample locations is still indicated by the `sampleLocationsEnable` member of VkPipelineSampleLocationsStateCreateInfoEXT.

- `VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV` specifies that the `pExclusiveScissors` state in VkPipelineViewportExclusiveScissorStateCreateInfoNV will be ignored and must be set dynamically with vkCmdSetExclusiveScissorNV before any draw commands. The number of exclusive scissor rectangles used by a pipeline is still specified by the `exclusiveScissorCount` member of VkPipelineViewportExclusiveScissorStateCreateInfoNV.

- `VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV` specifies that the `pShadingRatePalettes` state in VkPipelineViewportShadingRateImageStateCreateInfoNV will be ignored and must be set dynamically with vkCmdSetViewportShadingRatePaletteNV before any draw commands.

- `VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV` specifies that the coarse sample order state in VkPipelineViewportCoarseSampleOrderStateCreateInfoNV will be ignored and must be set dynamically with vkCmdSetCoarseSampleOrderNV before any draw commands.

- `VK_DYNAMIC_STATE_LINE_STIPPLE_EXT` specifies that the `lineStippleFactor` and `lineStipplePattern` state in VkPipelineRasterizationLineStateCreateInfoEXT will be ignored and must be set dynamically with vkCmdSetLineStippleEXT before any draws are performed with a pipeline state with VkPipelineRasterizationLineStateCreateInfoEXT member `stippledLineEnable` set to `VK_TRUE`.

- `VK_DYNAMIC_STATE_CULL_MODE_EXT` specifies that the `cullMode` state in VkPipelineRasterizationStateCreateInfo will be ignored and must be set dynamically with vkCmdSetCullModeEXT before any draw commands.

- `VK_DYNAMIC_STATE_FRONT_FACE_EXT` specifies that the `frontFace` state in VkPipelineRasterizationStateCreateInfo will be ignored and must be set dynamically with vkCmdSetFrontFaceEXT before any draw commands.

- `VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT` specifies that the `topology` state in VkPipelineInputAssemblyStateCreateInfo only specifies the topology class, and the specific topology order and adjacency must be set dynamically with vkCmdSetPrimitiveTopologyEXT before any draw commands.

- `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT` specifies that the `viewportCount` and `pViewports` state in VkPipelineViewportStateCreateInfo will be ignored and must be set dynamically with vkCmdSetViewportWithCountEXT before any draw call.

- `VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT` specifies that the `scissorCount` and `pScissors` state in VkPipelineViewportStateCreateInfo will be ignored and must be set dynamically with vkCmdSetScissorWithCountEXT before any draw call.

- `VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT` specifies that the `stride` state in VkVertexInputBindingDescription will be ignored and must be set dynamically with vkCmdBindVertexBuffers2EXT before any draw call.

- `VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT` specifies that the `depthTestEnable` state in VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthTestEnableEXT before any draw call.

- `VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT` specifies that the `depthWriteEnable` state in VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthWriteEnableEXT before any draw call.

- `VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT` specifies that the `depthCompareOp` state in VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthCompareOpEXT before any draw call.

- `VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT` specifies that the `depthBoundsTestEnable` state in VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetDepthBoundsTestEnableEXT before any draw call.

- `VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT` specifies that the `stencilTestEnable` state in VkPipelineDepthStencilStateCreateInfo will be ignored and must be set dynamically with vkCmdSetStencilTestEnableEXT before any draw call.

- `VK_DYNAMIC_STATE_STENCIL_OP_EXT` specifies that the `failOp`, `passOp`, `depthFailOp`, and `compareOp` states in `VkPipelineDepthStencilStateCreateInfo` for both `front` and `back` will be ignored and must be set dynamically with vkCmdSetStencilOpEXT before any draws are performed with a pipeline state with `VkPipelineDepthStencilStateCreateInfo` member `stencilTestEnable` set to `VK_TRUE`

## See Also

VkPipelineDynamicStateCreateInfo

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

SPDX-License-Identifier: CC-BY-4.0