17ec681f3Smrg.. _vertexelements:
27ec681f3Smrg
37ec681f3SmrgVertex Elements
47ec681f3Smrg===============
57ec681f3Smrg
67ec681f3SmrgThis state controls the format of the input attributes contained in
77ec681f3Smrgpipe_vertex_buffers. There is one pipe_vertex_element array member for each
87ec681f3Smrginput attribute.
97ec681f3Smrg
107ec681f3SmrgInput Formats
117ec681f3Smrg-------------
127ec681f3Smrg
137ec681f3SmrgGallium supports a diverse range of formats for vertex data. Drivers are
147ec681f3Smrgguaranteed to support 32-bit floating-point vectors of one to four components.
157ec681f3SmrgAdditionally, they may support the following formats:
167ec681f3Smrg
177ec681f3Smrg* Integers, signed or unsigned, normalized or non-normalized, 8, 16, or 32
187ec681f3Smrg  bits wide
197ec681f3Smrg* Floating-point, 16, 32, or 64 bits wide
207ec681f3Smrg
217ec681f3SmrgAt this time, support for varied vertex data formats is limited by driver
227ec681f3Smrgdeficiencies. It is planned to support a single uniform set of formats for all
237ec681f3SmrgGallium drivers at some point.
247ec681f3Smrg
257ec681f3SmrgRather than attempt to specify every small nuance of behavior, Gallium uses a
267ec681f3Smrgvery simple set of rules for padding out unspecified components. If an input
277ec681f3Smrguses less than four components, it will be padded out with the constant vector
287ec681f3Smrg``(0, 0, 0, 1)``.
297ec681f3Smrg
307ec681f3SmrgFog, point size, the facing bit, and edgeflags, all are in the standard format
317ec681f3Smrgof ``(x, 0, 0, 1)``, and so only the first component of those inputs is used.
327ec681f3Smrg
337ec681f3SmrgPosition
347ec681f3Smrg%%%%%%%%
357ec681f3Smrg
367ec681f3SmrgVertex position may be specified with two to four components. Using less than
377ec681f3Smrgtwo components is not allowed.
387ec681f3Smrg
397ec681f3SmrgColors
407ec681f3Smrg%%%%%%
417ec681f3Smrg
427ec681f3SmrgColors, both front- and back-facing, may omit the alpha component, only using
437ec681f3Smrgthree components. Using less than three components is not allowed.
447ec681f3Smrg
457ec681f3SmrgMembers
467ec681f3Smrg-------
477ec681f3Smrg
487ec681f3Smrgsrc_offset
497ec681f3Smrg    The byte offset of the attribute in the buffer given by
507ec681f3Smrg    vertex_buffer_index for the first vertex.
517ec681f3Smrginstance_divisor
527ec681f3Smrg    The instance data rate divisor, used for instancing.
537ec681f3Smrg    0 means this is per-vertex data, n means per-instance data used for
547ec681f3Smrg    n consecutive instances (n > 0).
557ec681f3Smrgvertex_buffer_index
567ec681f3Smrg    The vertex buffer this attribute lives in. Several attributes may
577ec681f3Smrg    live in the same vertex buffer.
587ec681f3Smrgsrc_format
597ec681f3Smrg    The format of the attribute data. One of the PIPE_FORMAT tokens.
60