Search code examples
vulkan

degenerate triangles fragment generation


Can I safely assume that, in polygon fill mode, with no culling, using VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, a degenerate zero area triangle (with all vertices sharing the same index) will always produce zero fragments (with or without multisampling)?

The specs (1.3.228) explicitly addresses degenerate zero area triangles only in the context of the VK_EXT_conservative_rasterization extension:

"Implementations can process degenerate triangles and lines by either discarding them or generating conservative fragments for them. Degenerate triangles are those that end up with zero area after the rasterizer quantizes them to the fixed-point pixel grid."

I am not using conservative rasterization, and I cannot find any reference that clarifies weather this case is actually guaranteed to generate zero fragments, or is otherwise left implementation-dependant (which may have unexpected results like generating a single fragment).


Solution

  • The standard doesn't need to state this explicitly. It is a natural consequence of the rasterization rules. Specifically:

    Fragments are produced for any fragment area groups of pixels for which any sample points lie inside of this polygon.

    If the polygon has no area, then no samples can lie inside of it, and therefore no fragments can be produced from it.