Scissor Test

Atualizado em 2023/10/21
Tempos estimado de leitura: 1 min

The scissor test compares the framebuffer coordinates (xf, yf) of each sample covered by a fragment against a scissor rectangle at the index equal to the fragment’s ViewportIndex.

Each scissor rectangle is defined by a afxRect. These values are either set by the VkPipelineViewportStateCreateInfo structure during pipeline creation, or dynamically by the AfxCmdSetScissors command.

A given sample is considered inside a scissor rectangle if xf is in the range [afxRect::offset[0], afxRect::offset[0] + afxRect::extent[0]), and yf is in the range [afxRect::offset[1], afxRect::offset[1] + afxRect::extent[1]). Samples with coordinates outside the scissor rectangle at the corresponding ViewportIndex will have their coverage set to 0.

To dynamically set the scissor rectangles, call:

void AfxCmdSetScissor
    afxDrawScript dscr, /// is the command buffer into which the command will be recorded.
    afxNat first, /// is the index of the first scissor whose state is updated by the command.
    afxNat cnt, /// is the number of scissors whose rectangles are updated by the command.
    afxRect const r[] /// is an array of afxRect structures defining scissor rectangles.

The scissor rectangles taken from element i of r replace the current state for the scissor index first + i, for i in [0, cnt).

This command sets the scissor rectangles for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_SCISSOR set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportStateCreateInfo::pScissors values used to create the currently active pipeline.

Esta publicação foi útil?
Desaprovar 0
Leituras: 2


Translate »