Top Description Fields Constructors Methods
org.lwjgl.vulkan

public Class EXTDiscardRectangles

extends Object
Class Inheritance
Imports
org.lwjgl.system.*

This extension provides additional orthogonally aligned “discard rectangles” specified in framebuffer-space coordinates that restrict rasterization of all points, lines and triangles.

From zero to an implementation-dependent limit (specified by maxDiscardRectangles) number of discard rectangles can be operational at once. When one or more discard rectangles are active, rasterized fragments can either survive if the fragment is within any of the operational discard rectangles (DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT mode) or be rejected if the fragment is within any of the operational discard rectangles (DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT mode).

These discard rectangles operate orthogonally to the existing scissor test functionality. The discard rectangles can be different for each physical device in a device group by specifying the device mask and setting discard rectangle dynamic state.

Version 2 of this extension introduces new dynamic states DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT and DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT, and the corresponding functions CmdSetDiscardRectangleEnableEXT and CmdSetDiscardRectangleModeEXT. Applications that use these dynamic states must ensure the implementation advertises at least specVersion 2 of this extension.

VK_EXT_discard_rectangles
Name String
VK_EXT_discard_rectangles
Extension Type
Device extension
Registered Extension Number
100
Revision
2
Extension and Version Dependencies
VK_KHR_get_physical_device_properties2 or Version 1.1
Contact
Other Extension Metadata
Last Modified Date
2023-01-18
Interactions and External Dependencies
Contributors
  • Daniel Koch, NVIDIA
  • Jeff Bolz, NVIDIA

Field Summary

Modifier and TypeField and Description
public static final int
VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT

VkDiscardRectangleModeEXT - Specify the discard rectangle mode Description

public static final int
VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT

VkDiscardRectangleModeEXT - Specify the discard rectangle mode Description

public static final int
public static final int
public static final int
public static final String
public static final int
VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION

The extension specification version.

public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
nvkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, int firstDiscardRectangle, int
the number of discard rectangles whose state are updated by the command.
discardRectangleCount
,
long pDiscardRectangles)

Unsafe version of: CmdSetDiscardRectangleEXT

public static void
vkCmdSetDiscardRectangleEnableEXT(VkCommandBuffer
the command buffer into which the command will be recorded.
commandBuffer
,
boolean
specifies whether discard rectangles are enabled or not.
discardRectangleEnable
)

Enable discard rectangles dynamically for a command buffer.

public static void
vkCmdSetDiscardRectangleEXT(VkCommandBuffer
the command buffer into which the command will be recorded.
commandBuffer
,
int
the index of the first discard rectangle whose state is updated by the command.
firstDiscardRectangle
,
VkRect2D.Buffer
a pointer to an array of VkRect2D structures specifying discard rectangles.
pDiscardRectangles
)

Set discard rectangles dynamically for a command buffer.

public static void
vkCmdSetDiscardRectangleModeEXT(VkCommandBuffer
the command buffer into which the command will be recorded.
commandBuffer
,
int
specifies the discard rectangle mode for all discard rectangles, either inclusive or exclusive.
discardRectangleMode
)

Sets the discard rectangle mode dynamically for a command buffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXTback to summary
public static final int VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT

VkDiscardRectangleModeEXT - Specify the discard rectangle mode

Description
See Also

VkPipelineDiscardRectangleStateCreateInfoEXT, CmdSetDiscardRectangleModeEXT

VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXTback to summary
public static final int VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT

VkDiscardRectangleModeEXT - Specify the discard rectangle mode

Description
See Also

VkPipelineDiscardRectangleStateCreateInfoEXT, CmdSetDiscardRectangleModeEXT

VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXTback to summary
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT

Extends VkDynamicState.

Enum values:
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXTback to summary
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT

Extends VkDynamicState.

Enum values:
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXTback to summary
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT

Extends VkDynamicState.

Enum values:
VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAMEback to summary
public static final String VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME

The extension name.

VK_EXT_DISCARD_RECTANGLES_SPEC_VERSIONback to summary
public static final int VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION

The extension specification version.

VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXTback to summary
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT

Extends VkStructureType.

Enum values:
VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXTback to summary
public static final int VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT

Extends VkStructureType.

Enum values:

Constructor Detail

EXTDiscardRectanglesback to summary
protected EXTDiscardRectangles()

Method Detail

nvkCmdSetDiscardRectangleEXTback to summary
public static void nvkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, int firstDiscardRectangle, int discardRectangleCount, long pDiscardRectangles)

Unsafe version of: CmdSetDiscardRectangleEXT

Parameters
discardRectangleCount:int

the number of discard rectangles whose state are updated by the command.

vkCmdSetDiscardRectangleEnableEXTback to summary
public static void vkCmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, boolean discardRectangleEnable)

Enable discard rectangles dynamically for a command buffer.

C Specification

To dynamically set whether discard rectangles are enabled, call:


void vkCmdSetDiscardRectangleEnableEXT(
    VkCommandBuffer                             commandBuffer,
    VkBool32                                    discardRectangleEnable);
Description

This command sets the discard rectangle enable for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is implied by the VkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleCount value used to create the currently active pipeline, where a non-zero discardRectangleCount implicitly enables discard rectangles, otherwise they are disabled.

Valid Usage
  • The VK_EXT_discard_rectangles extension must be enabled, and the implementation must support at least specVersion 2 of this extension
Valid Usage (Implicit)
  • commandBuffer must be a valid VkCommandBuffer handle
  • commandBuffer must be in the recording state
  • The VkCommandPool that commandBuffer was allocated from must support graphics operations
  • 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 LevelsRender Pass ScopeVideo Coding ScopeSupported Queue TypesCommand Type
Primary SecondaryBothOutsideGraphicsState
Parameters
commandBuffer:VkCommandBuffer

the command buffer into which the command will be recorded.

discardRectangleEnable:boolean

specifies whether discard rectangles are enabled or not.

vkCmdSetDiscardRectangleEXTback to summary
public static void vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, int firstDiscardRectangle, VkRect2D.Buffer pDiscardRectangles)

Set discard rectangles dynamically for a command buffer.

C Specification

To dynamically set the discard rectangles, call:


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

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

This command sets the discard rectangles for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with DYNAMIC_STATE_DISCARD_RECTANGLE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineDiscardRectangleStateCreateInfoEXT::pDiscardRectangles values used to create the currently active pipeline.

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
  • If this command is recorded in a secondary command buffer with VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2D enabled, then this function must not be called
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
  • This command must only be called outside of a video coding scope
  • 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 LevelsRender Pass ScopeVideo Coding ScopeSupported Queue TypesCommand Type
Primary SecondaryBothOutsideGraphicsState
See Also

VkRect2D

Parameters
commandBuffer:VkCommandBuffer

the command buffer into which the command will be recorded.

firstDiscardRectangle:int

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

pDiscardRectangles:VkRect2D.Buffer

a pointer to an array of VkRect2D structures specifying discard rectangles.

vkCmdSetDiscardRectangleModeEXTback to summary
public static void vkCmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, int discardRectangleMode)

Sets the discard rectangle mode dynamically for a command buffer.

C Specification

To dynamically set the discard rectangle mode, call:


void vkCmdSetDiscardRectangleModeEXT(
    VkCommandBuffer                             commandBuffer,
    VkDiscardRectangleModeEXT                   discardRectangleMode);
Description

This command sets the discard rectangle mode for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleMode value used to create the currently active pipeline.

Valid Usage
  • The VK_EXT_discard_rectangles extension must be enabled, and the implementation must support at least specVersion 2 of this extension
Valid Usage (Implicit)
  • commandBuffer must be a valid VkCommandBuffer handle
  • discardRectangleMode must be a valid VkDiscardRectangleModeEXT value
  • commandBuffer must be in the recording state
  • The VkCommandPool that commandBuffer was allocated from must support graphics operations
  • 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 LevelsRender Pass ScopeVideo Coding ScopeSupported Queue TypesCommand Type
Primary SecondaryBothOutsideGraphicsState
Parameters
commandBuffer:VkCommandBuffer

the command buffer into which the command will be recorded.

discardRectangleMode:int

specifies the discard rectangle mode for all discard rectangles, either inclusive or exclusive.