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