org.lwjgl.vulkan.EXTDiscardRectangles Maven / Gradle / Ivy
Show all versions of lwjgl-vulkan Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
/**
* This extension provides additional orthogonally aligned "{@code 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 {@code 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 ({@link #VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT} mode) or be rejected if the fragment is within any of the operational discard rectangles ({@link #VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT} mode).
*
* These discard rectangles operate orthogonally to the existing scissor test functionality. If the {@link KHXDeviceGroup VK_KHX_device_group} extension is enabled the discard rectangles can be different for each physical device in the device group by specifying the device mask and setting discard rectangle dynamic state.
*
*
* - Name String
* - {@code VK_EXT_discard_rectangles}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 100
* - Revision
* - 1
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2}
*
* - Contact
*
* - Piers Daniell @pdaniell
*
* - Last Modified Date
* - 2016-12-22
* - Contributors
*
* - Daniel Koch, NVIDIA
* - Jeff Bolz, NVIDIA
*
*
*/
public class EXTDiscardRectangles {
/** The extension specification version. */
public static final int VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME = "VK_EXT_discard_rectangles";
/**
* Extends {@code VkStructureType}.
*
* Enum values:
*
*
* - {@link #VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT}
* - {@link #VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT}
*
*/
public static final int
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000,
VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001;
/** Extends {@code VkDynamicState}. */
public static final int VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000;
/**
* VkDiscardRectangleModeEXT - Specify the discard rectangle mode
*
* Description
*
*
* - {@link #VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT} specifies that a fragment within any discard rectangle satisfies the test.
* - {@link #VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT} specifies that a fragment not within any of the discard rectangles satisfies the test.
*
*
* See Also
*
* {@link VkPipelineDiscardRectangleStateCreateInfoEXT}
*/
public static final int
VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0,
VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1;
protected EXTDiscardRectangles() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(VKCapabilitiesDevice caps) {
return checkFunctions(
caps.vkCmdSetDiscardRectangleEXT
);
}
// --- [ vkCmdSetDiscardRectangleEXT ] ---
/**
* Unsafe version of: {@link #vkCmdSetDiscardRectangleEXT CmdSetDiscardRectangleEXT}
*
* @param discardRectangleCount the number of discard rectangles whose state are updated by the command.
*/
public static void nvkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, int firstDiscardRectangle, int discardRectangleCount, long pDiscardRectangles) {
long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDiscardRectangleEXT;
if (CHECKS) {
check(__functionAddress);
}
callPPV(__functionAddress, commandBuffer.address(), firstDiscardRectangle, discardRectangleCount, pDiscardRectangles);
}
/**
* Set discard rectangles dynamically.
*
* C Specification
*
* If the pipeline state object was created with the {@link #VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT 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);
*
* Description
*
* The discard rectangle taken from element i
of {@code pDiscardRectangles} replace the current state for the discard rectangle index firstDiscardRectangle + i
, for i
in [0, discardRectangleCount)
.
*
* Valid Usage
*
*
* - The currently bound graphics pipeline must have been created with the {@link #VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT DYNAMIC_STATE_DISCARD_RECTANGLE_EXT} dynamic state enabled
* - The sum of {@code firstDiscardRectangle} and {@code discardRectangleCount} must be less than or equal to {@link VkPhysicalDeviceDiscardRectanglePropertiesEXT}{@code ::maxDiscardRectangles}
* - The {@code x} and {@code y} member of {@code offset} in each {@link VkRect2D} element of {@code pDiscardRectangles} must be greater than or equal to 0
* - Evaluation of
(offset.x + extent.width)
in each {@link VkRect2D} element of {@code pDiscardRectangles} must not cause a signed integer addition overflow
* - Evaluation of
(offset.y + extent.height)
in each {@link VkRect2D} element of {@code pDiscardRectangles} must not cause a signed integer addition overflow
*
*
* Valid Usage (Implicit)
*
*
* - {@code commandBuffer} must be a valid {@code VkCommandBuffer} handle
* - {@code pDiscardRectangles} must be a valid pointer to an array of {@code discardRectangleCount} {@link VkRect2D} structures
* - {@code commandBuffer} must be in the recording state
* - The {@code VkCommandPool} that {@code commandBuffer} was allocated from must support graphics operations
* - {@code discardRectangleCount} must be greater than 0
*
*
* Host Synchronization
*
*
* - Host access to {@code commandBuffer} must be externally synchronized
* - Host access to the {@code VkCommandPool} that {@code 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
*
* {@link VkRect2D}
*
* @param commandBuffer the command buffer into which the command will be recorded.
* @param firstDiscardRectangle the index of the first discard rectangle whose state is updated by the command.
* @param pDiscardRectangles a pointer to an array of {@link VkRect2D} structures specifying discard rectangles.
*/
public static void vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstDiscardRectangle, @NativeType("const VkRect2D *") VkRect2D.Buffer pDiscardRectangles) {
nvkCmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, pDiscardRectangles.remaining(), pDiscardRectangles.address());
}
}