Class EXTDiscardRectangles
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.
- 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_properties2or Version 1.1- Contact
- Piers Daniell pdaniell-nv
Other Extension Metadata
- Last Modified Date
- 2023-01-18
- Interactions and External Dependencies
- Interacts with
VK_KHR_device_group - Interacts with Vulkan 1.1
- Interacts with
- Contributors
- Daniel Koch, NVIDIA
- Jeff Bolz, NVIDIA
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVkDiscardRectangleModeEXT - Specify the discard rectangle modestatic final intVkDiscardRectangleModeEXT - Specify the discard rectangle modestatic final intExtendsVkDynamicState.static final intExtendsVkDynamicState.static final intExtendsVkDynamicState.static final StringThe extension name.static final intThe extension specification version.static final intExtendsVkStructureType.static final intExtendsVkStructureType. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidnvkCmdSetDiscardRectangleEXT(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int firstDiscardRectangle, int discardRectangleCount, long pDiscardRectangles) Unsafe version of:CmdSetDiscardRectangleEXTstatic voidvkCmdSetDiscardRectangleEnableEXT(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, boolean discardRectangleEnable) Enable discard rectangles dynamically for a command buffer.static voidvkCmdSetDiscardRectangleEXT(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int firstDiscardRectangle, VkRect2D.Buffer pDiscardRectangles) Set discard rectangles dynamically for a command buffer.static voidvkCmdSetDiscardRectangleModeEXT(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int discardRectangleMode) Sets the discard rectangle mode dynamically for a command buffer.
-
Field Details
-
VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION
public static final int VK_EXT_DISCARD_RECTANGLES_SPEC_VERSIONThe extension specification version.- See Also:
-
VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME
The extension name.- See Also:
-
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXTExtendsVkStructureType.Enum values:
- See Also:
-
VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT
public static final int VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXTExtendsVkStructureType.Enum values:
- See Also:
-
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXTExtendsVkDynamicState.Enum values:
- See Also:
-
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXTExtendsVkDynamicState.Enum values:
- See Also:
-
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXTExtendsVkDynamicState.Enum values:
- See Also:
-
VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT
public static final int VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXTVkDiscardRectangleModeEXT - Specify the discard rectangle modeDescription
DISCARD_RECTANGLE_MODE_INCLUSIVE_EXTspecifies that the discard rectangle test is inclusive.DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXTspecifies that the discard rectangle test is exclusive.
See Also
VkPipelineDiscardRectangleStateCreateInfoEXT,CmdSetDiscardRectangleModeEXT- See Also:
-
VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT
public static final int VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXTVkDiscardRectangleModeEXT - Specify the discard rectangle modeDescription
DISCARD_RECTANGLE_MODE_INCLUSIVE_EXTspecifies that the discard rectangle test is inclusive.DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXTspecifies that the discard rectangle test is exclusive.
See Also
VkPipelineDiscardRectangleStateCreateInfoEXT,CmdSetDiscardRectangleModeEXT- See Also:
-
-
Method Details
-
nvkCmdSetDiscardRectangleEXT
public static void nvkCmdSetDiscardRectangleEXT(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int firstDiscardRectangle, int discardRectangleCount, long pDiscardRectangles) Unsafe version of:CmdSetDiscardRectangleEXT- Parameters:
discardRectangleCount- the number of discard rectangles whose state are updated by the command.
-
vkCmdSetDiscardRectangleEXT
public static void vkCmdSetDiscardRectangleEXT(org.lwjgl.vulkan.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
iofpDiscardRectanglesreplace the current state for the discard rectangle at indexfirstDiscardRectangle + i, foriin[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_EXTset inVkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by theVkPipelineDiscardRectangleStateCreateInfoEXT::pDiscardRectanglesvalues used to create the currently active pipeline.Valid Usage
- The sum of
firstDiscardRectangleanddiscardRectangleCountmust be less than or equal toVkPhysicalDeviceDiscardRectanglePropertiesEXT::maxDiscardRectangles - The
xandymember ofoffsetin eachVkRect2Delement ofpDiscardRectanglesmust be greater than or equal to 0 - Evaluation of
(offset.x + extent.width)in eachVkRect2Delement ofpDiscardRectanglesmust not cause a signed integer addition overflow - Evaluation of
(offset.y + extent.height)in eachVkRect2Delement ofpDiscardRectanglesmust not cause a signed integer addition overflow - If this command is recorded in a secondary command buffer with
VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2Denabled, then this function must not be called
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepDiscardRectanglesmust be a valid pointer to an array ofdiscardRectangleCountVkRect2DstructurescommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support graphics operations - This command must only be called outside of a video coding scope
discardRectangleCountmust be greater than 0
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas 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
- Parameters:
commandBuffer- the command buffer into which the command will be recorded.firstDiscardRectangle- the index of the first discard rectangle whose state is updated by the command.pDiscardRectangles- a pointer to an array ofVkRect2Dstructures specifying discard rectangles.
- The sum of
-
vkCmdSetDiscardRectangleEnableEXT
public static void vkCmdSetDiscardRectangleEnableEXT(org.lwjgl.vulkan.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_EXTset inVkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is implied by theVkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleCountvalue used to create the currently active pipeline, where a non-zerodiscardRectangleCountimplicitly enables discard rectangles, otherwise they are disabled.Valid Usage
- The
VK_EXT_discard_rectanglesextension must be enabled, and the implementation must support at leastspecVersion2 of this extension
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support graphics operations - This command must only be called outside of a video coding scope
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas 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 - Parameters:
commandBuffer- the command buffer into which the command will be recorded.discardRectangleEnable- specifies whether discard rectangles are enabled or not.
- The
-
vkCmdSetDiscardRectangleModeEXT
public static void vkCmdSetDiscardRectangleModeEXT(org.lwjgl.vulkan.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_EXTset inVkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by theVkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleModevalue used to create the currently active pipeline.Valid Usage
- The
VK_EXT_discard_rectanglesextension must be enabled, and the implementation must support at leastspecVersion2 of this extension
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlediscardRectangleModemust be a validVkDiscardRectangleModeEXTvaluecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support graphics operations - This command must only be called outside of a video coding scope
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas 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 - Parameters:
commandBuffer- the command buffer into which the command will be recorded.discardRectangleMode- specifies the discard rectangle mode for all discard rectangles, either inclusive or exclusive.
- The
-