vkCmdSetFragmentShadingRateKHR(3)

# vkCmdSetFragmentShadingRateKHR(3) Manual Page

## Name

vkCmdSetFragmentShadingRateKHR - Set pipeline fragment shading rate and combiner operation dynamically for a command buffer

Loading… please wait.

## C Specification

To dynamically set the pipeline fragment shading rate and combiner operation, call:

    // Provided by VK_KHR_fragment_shading_rate
    void vkCmdSetFragmentShadingRateKHR(
        VkCommandBuffer                             commandBuffer,
        const VkExtent2D*                           pFragmentSize,
        const VkFragmentShadingRateCombinerOpKHR    combinerOps[2]);

## Parameters

- `commandBuffer` is the command buffer into which the command will be recorded.

- `pFragmentSize` specifies the pipeline fragment shading rate for subsequent drawing commands.

- `combinerOps` specifies a VkFragmentShadingRateCombinerOpKHR determining how the pipeline, primitive, and attachment shading rates are combined for fragments generated by subsequent drawing commands.

## Description

This command sets the pipeline fragment shading rate and combiner operation for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with `VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR` set in VkPipelineDynamicStateCreateInfo::`pDynamicStates`. Otherwise, this state is specified by the VkPipelineFragmentShadingRateStateCreateInfoKHR values used to create the currently active pipeline.

Valid Usage

- VUID-vkCmdSetFragmentShadingRateKHR-pipelineFragmentShadingRate-04507
  If the `pipelineFragmentShadingRate` feature is not enabled, `pFragmentSize->width` must be `1`

- VUID-vkCmdSetFragmentShadingRateKHR-pipelineFragmentShadingRate-04508
  If the `pipelineFragmentShadingRate` feature is not enabled, `pFragmentSize->height` must be `1`

- VUID-vkCmdSetFragmentShadingRateKHR-pipelineFragmentShadingRate-04509
  One of the `pipelineFragmentShadingRate`, `primitiveFragmentShadingRate`, or `attachmentFragmentShadingRate` features must be enabled

- VUID-vkCmdSetFragmentShadingRateKHR-primitiveFragmentShadingRate-04510
  If the `primitiveFragmentShadingRate` feature is not enabled, `combinerOps`[0] must be `VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR`

- VUID-vkCmdSetFragmentShadingRateKHR-attachmentFragmentShadingRate-04511
  If the `attachmentFragmentShadingRate` feature is not enabled, `combinerOps`[1] must be `VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR`

- VUID-vkCmdSetFragmentShadingRateKHR-fragmentSizeNonTrivialCombinerOps-04512
  If the `fragmentSizeNonTrivialCombinerOps` limit is not supported, elements of `combinerOps` must be either `VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR` or `VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR`

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04513
  `pFragmentSize->width` must be greater than or equal to `1`

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04514
  `pFragmentSize->height` must be greater than or equal to `1`

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04515
  `pFragmentSize->width` must be a power-of-two value

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04516
  `pFragmentSize->height` must be a power-of-two value

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04517
  `pFragmentSize->width` must be less than or equal to `4`

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-04518
  `pFragmentSize->height` must be less than or equal to `4`

Valid Usage (Implicit)

- VUID-vkCmdSetFragmentShadingRateKHR-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdSetFragmentShadingRateKHR-pFragmentSize-parameter
  `pFragmentSize` must be a valid pointer to a valid VkExtent2D structure

- VUID-vkCmdSetFragmentShadingRateKHR-combinerOps-parameter
  Each element of `combinerOps` must be a valid VkFragmentShadingRateCombinerOpKHR value

- VUID-vkCmdSetFragmentShadingRateKHR-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdSetFragmentShadingRateKHR-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics operations

- VUID-vkCmdSetFragmentShadingRateKHR-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

Command Properties

Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type
--- | --- | --- | --- | ---
Primary Secondary | Both | Outside | Graphics | State

## See Also

VK_KHR_fragment_shading_rate, VkCommandBuffer, VkExtent2D, VkFragmentShadingRateCombinerOpKHR

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

SPDX-License-Identifier: CC-BY-4.0