xref: /aosp_15_r20/external/mesa3d/docs/gallium/cso/velems.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1.. _vertexelements:
2
3Vertex Elements
4===============
5
6This state controls the format of the input attributes contained in
7pipe_vertex_buffers. There is one pipe_vertex_element array member for each
8input attribute.
9
10Input Formats
11-------------
12
13Gallium supports a diverse range of formats for vertex data. Drivers are
14guaranteed to support 32-bit floating-point vectors of one to four components.
15Additionally, they may support the following formats:
16
17* Integers, signed or unsigned, normalized or non-normalized, 8, 16, or 32
18  bits wide
19* Floating-point, 16, 32, or 64 bits wide
20
21At this time, support for varied vertex data formats is limited by driver
22deficiencies. It is planned to support a single uniform set of formats for all
23Gallium drivers at some point.
24
25Rather than attempt to specify every small nuance of behavior, Gallium uses a
26very simple set of rules for padding out unspecified components. If an input
27uses less than four components, it will be padded out with the constant vector
28``(0, 0, 0, 1)``.
29
30Fog, point size, the facing bit, and edge flags, all are in the standard
31format of ``(x, 0, 0, 1)``, and so only the first component of those inputs is
32used.
33
34Position
35%%%%%%%%
36
37Vertex position may be specified with two to four components. Using less than
38two components is not allowed.
39
40Colors
41%%%%%%
42
43Colors, both front- and back-facing, may omit the alpha component, only using
44three components. Using less than three components is not allowed.
45
46Members
47-------
48
49src_offset
50    The byte offset of the attribute in the buffer given by
51    vertex_buffer_index for the first vertex.
52instance_divisor
53    The instance data rate divisor, used for instancing.
54    0 means this is per-vertex data, n means per-instance data used for
55    n consecutive instances (n > 0).
56vertex_buffer_index
57    The vertex buffer this attribute lives in. Several attributes may
58    live in the same vertex buffer.
59src_format
60    The format of the attribute data. One of the PIPE_FORMAT tokens.
61