Push constant updates
Push constants are specially designed to update the shader constant data using the command buffer instead of updating the resources with the write or copy descriptors.
Note
Push constants offer a high-speed optimized path to update the constant data in the pipeline.
In this section, we will quickly implement an example to demonstrate a push constant. We will learn how push constants are used with command buffers to update the resource contents in the shader. This example defines two types of resources in the fragment shader—constColor
and mixerValue
—within the push constant uniform block pushConstantsColorBlock
. The constColor
resource contains an integer value that is used as a flag to render the rotating cube in a solid color (red, green, or blue). The mixerValue
resource is a floating value that mixes with the cube color.
Defining the push constant resource in the shader
The push constant resource in the shader is defined using the push_constant
keyword...