VKCMDPUSHCONSTANTS(3)

NAME
vkCmdPushConstants - Update the values of push constants.

C SPECIFICATION

    void vkCmdPushConstants(
        VkCommandBuffer                             commandBuffer,
        VkPipelineLayout                            layout,
        VkShaderStageFlags                          stageFlags,
        uint32_t                                    offset,
        uint32_t                                    size,
        const void*                                 pValues);

PARAMETERS

commandBuffer
    A handle to the command buffer into which to insert the command.

layout
    A handle to the pipeline layout describing the layout of the push constants.

stageFlags
    A bitmask specifying the pipeline stages for which to update push constants.

offset
    The offset of the first push constant to update in the layout.

size
    The size of the push constants to update.

pValues
    A pointer to a region of memory containing the new values for the push constants.

DESCRIPTION

vkCmdPushConstants updates the values of push constants for the command buffer specified by commandBuffer. Push constants become visible to the next drawing or dispatch command appended to commandBuffer. layout specifies a handle to a pipeline layout object containing the layout information for the push constants. stageFlags specifies the pipeline stages for which the push constant update is to be applied. This parameter is a bitwise combination of members of the VkShaderStageFlagBits enumeration and must match the shader stages used in the pipeline layout for the range specified by offset and size. The definition of VkShaderStageFlagBits is:

    typedef enum VkShaderStageFlagBits {
        VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
        VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
        VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
        VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
        VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
        VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
        VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
        VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
    } VkShaderStageFlagBits;

offset and size specify the offset of the start of the region to be updated and its size, respectively. Both are in units of bytes.

pValues is a pointer to a region of size bytes of memory containing the new values for the specified push constants.

VALID USAGE

    • commandBuffer must be a valid VkCommandBuffer handle

    • layout must be a valid VkPipelineLayout handle

    • stageFlags must be a valid combination of VkShaderStageFlagBits values

    • stageFlags must not be 0

    • pValues must be a pointer to an array of size bytes

    • commandBuffer must be in the recording state

    • The VkCommandPool that commandBuffer was allocated from must support graphics or compute operations

    • size must be greater than 0

    • Each of commandBuffer and layout must have been created, allocated or retrieved from the same VkDevice

    • stageFlags must match exactly the shader stages used in layout for the range specified by offset and size

    • offset must be a multiple of 4

    • size must be a multiple of 4

    • offset must be less than VkPhysicalDeviceLimits::maxPushConstantsSize

    • size must be less than or equal to VkPhysicalDeviceLimits::maxPushConstantsSize minus offset

HOST SYNCHRONIZATION

    • Host access to commandBuffer must be externally synchronized

COMMAND PROPERTIES
Command Buffer Levels | Render Pass Scope | Supported Queue Types
Primary Secondary | Both | GRAPHICS COMPUTE

SEE ALSO

vkCreatePipelineLayout, VkPipelineStageFlags

COPYRIGHT

Copyright © 2014-2016 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

AUTHOR

Khronos Group
    Author.