Skip to main content

Module geometry

Module geometry 

Source
Expand description

A geometry program on the CPU: what the input assembler does before it and what a draw does around it, since WGSL has no geometry stage. Topology assembles a draw’s vertices into the primitives the program reads (with the adjacent vertices of the *Adjacency topologies), GeometryShader::draw runs the program for every primitive and every one of its instances and returns the strips it emitted, and Strip::primitives assembles a strip’s vertices into the points, lines and triangles they make.

A vertex is one register per input varying of the program, in the order of its interface (the names are GeometryShader::inputs); an emitted vertex is one register per output varying (GeometryShader::outputs). The program is the function-form Program of iridia::stage_functions, run one invocation at a time with Executable::function.

The assembly rules are the ones D3D11’s input assembler and stream output follow, measured with the D3D11 reference of WARP (a probe program streamed the draw’s vertices’ numbers out through a geometry shader that writes each input vertex out): a triangle strip’s odd primitives swap their last two vertices, so that every triangle keeps its winding; a triangle strip with adjacency is numbered as Topology::TriangleStripAdjacency says; SV_PrimitiveID counts the primitives of the draw from 0; the instances of a primitive run in order before the next primitive’s. A draw with a restart index (an index list holding the value that cuts a strip) is refused by GeometryShader::draw_indexed: what the assembler makes of the vertices around a cut is not measured.

Structs§

GeometryShader
A geometry program ready to run.
Strip
The vertices an invocation emitted between two cuts, with the primitive and the instance that emitted them.

Enums§

Topology
How a draw’s vertices make primitives (D3D’s primitive topologies a geometry shader can follow).

Type Aliases§

Vertex
The values of one vertex: a register (four 32-bit lanes) for each varying.