1848b8605Smrg.. _vertexelements:
2848b8605Smrg
3848b8605SmrgVertex Elements
4848b8605Smrg===============
5848b8605Smrg
6848b8605SmrgThis state controls the format of the input attributes contained in
7848b8605Smrgpipe_vertex_buffers. There is one pipe_vertex_element array member for each
8848b8605Smrginput attribute.
9848b8605Smrg
10848b8605SmrgInput Formats
11848b8605Smrg-------------
12848b8605Smrg
13848b8605SmrgGallium supports a diverse range of formats for vertex data. Drivers are
14848b8605Smrgguaranteed to support 32-bit floating-point vectors of one to four components.
15848b8605SmrgAdditionally, they may support the following formats:
16848b8605Smrg
17848b8605Smrg* Integers, signed or unsigned, normalized or non-normalized, 8, 16, or 32
18848b8605Smrg  bits wide
19848b8605Smrg* Floating-point, 16, 32, or 64 bits wide
20848b8605Smrg
21848b8605SmrgAt this time, support for varied vertex data formats is limited by driver
22848b8605Smrgdeficiencies. It is planned to support a single uniform set of formats for all
23848b8605SmrgGallium drivers at some point.
24848b8605Smrg
25848b8605SmrgRather than attempt to specify every small nuance of behavior, Gallium uses a
26848b8605Smrgvery simple set of rules for padding out unspecified components. If an input
27848b8605Smrguses less than four components, it will be padded out with the constant vector
28848b8605Smrg``(0, 0, 0, 1)``.
29848b8605Smrg
30848b8605SmrgFog, point size, the facing bit, and edgeflags, all are in the standard format
31848b8605Smrgof ``(x, 0, 0, 1)``, and so only the first component of those inputs is used.
32848b8605Smrg
33848b8605SmrgPosition
34848b8605Smrg%%%%%%%%
35848b8605Smrg
36848b8605SmrgVertex position may be specified with two to four components. Using less than
37848b8605Smrgtwo components is not allowed.
38848b8605Smrg
39848b8605SmrgColors
40848b8605Smrg%%%%%%
41848b8605Smrg
42848b8605SmrgColors, both front- and back-facing, may omit the alpha component, only using
43848b8605Smrgthree components. Using less than three components is not allowed.
44848b8605Smrg
45848b8605SmrgMembers
46848b8605Smrg-------
47848b8605Smrg
48848b8605Smrgsrc_offset
49848b8605Smrg    The byte offset of the attribute in the buffer given by
50848b8605Smrg    vertex_buffer_index for the first vertex.
51848b8605Smrginstance_divisor
52848b8605Smrg    The instance data rate divisor, used for instancing.
53848b8605Smrg    0 means this is per-vertex data, n means per-instance data used for
54848b8605Smrg    n consecutive instances (n > 0).
55848b8605Smrgvertex_buffer_index
56848b8605Smrg    The vertex buffer this attribute lives in. Several attributes may
57848b8605Smrg    live in the same vertex buffer.
58848b8605Smrgsrc_format
59848b8605Smrg    The format of the attribute data. One of the PIPE_FORMAT tokens.
60