# vkCmdSetDiscardRectangleEXT(3) Manual Page

## Name

vkCmdSetDiscardRectangleEXT - Set discard rectangles dynamically

## C Specification

If the pipeline state object was created with the `VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT` dynamic state enabled, the discard rectangles are dynamically set and changed with the command:

    void vkCmdSetDiscardRectangleEXT(
        VkCommandBuffer                             commandBuffer,
        uint32_t                                    firstDiscardRectangle,
        uint32_t                                    discardRectangleCount,
        const VkRect2D*                             pDiscardRectangles);

## Parameters

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

- `firstDiscardRectangle` is the index of the first discard rectangle whose state is updated by the command.

- `discardRectangleCount` is the number of discard rectangles whose state are updated by the command.

- `pDiscardRectangles` is a pointer to an array of VkRect2D structures specifying discard rectangles.

## Description

The discard rectangle taken from element i of `pDiscardRectangles` replace the current state for the discard rectangle index `firstDiscardRectangle` + i, for i in [0, `discardRectangleCount`).

Valid Usage

- The sum of `firstDiscardRectangle` and `discardRectangleCount` must be less than or equal to VkPhysicalDeviceDiscardRectanglePropertiesEXT::`maxDiscardRectangles`

- The `x` and `y` member of `offset` in each VkRect2D element of `pDiscardRectangles` must be greater than or equal to `0`

- Evaluation of (`offset.x` + `extent.width`) in each VkRect2D element of `pDiscardRectangles` must not cause a signed integer addition overflow

- Evaluation of (`offset.y` + `extent.height`) in each VkRect2D element of `pDiscardRectangles` must not cause a signed integer addition overflow

Valid Usage (Implicit)

- `commandBuffer` must be a valid VkCommandBuffer handle

- `pDiscardRectangles` must be a valid pointer to an array of `discardRectangleCount` VkRect2D structures

- `commandBuffer` must be in the recording state

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

- `discardRectangleCount` must be greater than `0`

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 | Supported Queue Types | Pipeline Type
--- | --- | --- | ---
Primary Secondary | Both | Graphics |

## See Also

VkCommandBuffer, VkRect2D

## 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 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.