Function Prototype

vkCmdSetDepthBias

Set depth bias factors and clamp dynamically for a command buffer
primary / secondary
both
graphics
state

To dynamically set the depth bias parameters, call:

void vkCmdSetDepthBias(
    VkCommandBuffer commandBuffer,
    float depthBiasConstantFactor,
    float depthBiasClamp,
    float depthBiasSlopeFactor);
  • commandBuffer is the command buffer into which the command will be recorded.
  • depthBiasConstantFactor is a scalar factor controlling the constant depth value added to each fragment.
  • depthBiasClamp is the maximum (or minimum) depth bias of a fragment.
  • depthBiasSlopeFactor is a scalar factor applied to a fragment’s slope in depth bias calculations.

This command sets the depth bias parameters for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_BIAS set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineRasterizationStateCreateInfo::depthBiasConstantFactor, depthBiasClamp, and depthBiasSlopeFactor values used to create the currently active pipeline.

Calling this function is equivalent to calling vkCmdSetDepthBias2EXT without a VkDepthBiasRepresentationInfoEXT in the pNext chain of VkDepthBiasInfoEXT.

Valid Usage

VUID-vkCmdSetDepthBias-depthBiasClamp-00790

If the depthBiasClamp feature is not enabled, depthBiasClamp must be 0.0

Valid Usage (Implicit)

VUID-vkCmdSetDepthBias-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support graphics operations

VUID-vkCmdSetDepthBias-videocoding

This command must only be called outside of a video coding scope

Host Synchronization

  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized ::