1 /*
2  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
3  Intel funded Tungsten Graphics to
4  develop this 3D driver.
5 
6  Permission is hereby granted, free of charge, to any person obtaining
7  a copy of this software and associated documentation files (the
8  "Software"), to deal in the Software without restriction, including
9  without limitation the rights to use, copy, modify, merge, publish,
10  distribute, sublicense, and/or sell copies of the Software, and to
11  permit persons to whom the Software is furnished to do so, subject to
12  the following conditions:
13 
14  The above copyright notice and this permission notice (including the
15  next paragraph) shall be included in all copies or substantial
16  portions of the Software.
17 
18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 
26  **********************************************************************/
27  /*
28   * Authors:
29   *   Keith Whitwell <keithw@vmware.com>
30   */
31 
32 #ifndef VBO_ATTRIB_H
33 #define VBO_ATTRIB_H
34 
35 /*
36  * Note: The first 32 attributes match the VERT_ATTRIB_* definitions.
37  * However, we have extra attributes for storing per-vertex glMaterial
38  * values.  The material attributes get shifted into the generic positions
39  * at draw time.
40  *
41  * One reason we can't alias materials and generics here is display lists.
42  * A display list might contain both generic attributes and material
43  * attributes which are selected at draw time depending on whether we're
44  * using fixed function or a shader.  <sigh>
45  */
46 enum vbo_attrib {
47    VBO_ATTRIB_POS,
48    VBO_ATTRIB_NORMAL,
49    VBO_ATTRIB_COLOR0,
50    VBO_ATTRIB_COLOR1,
51    VBO_ATTRIB_FOG,
52    VBO_ATTRIB_COLOR_INDEX,
53    VBO_ATTRIB_EDGEFLAG,
54    VBO_ATTRIB_TEX0,
55    VBO_ATTRIB_TEX1,
56    VBO_ATTRIB_TEX2,
57    VBO_ATTRIB_TEX3,
58    VBO_ATTRIB_TEX4,
59    VBO_ATTRIB_TEX5,
60    VBO_ATTRIB_TEX6,
61    VBO_ATTRIB_TEX7,
62    VBO_ATTRIB_POINT_SIZE,
63 
64    VBO_ATTRIB_GENERIC0, /* Not used? */
65    VBO_ATTRIB_GENERIC1,
66    VBO_ATTRIB_GENERIC2,
67    VBO_ATTRIB_GENERIC3,
68    VBO_ATTRIB_GENERIC4,
69    VBO_ATTRIB_GENERIC5,
70    VBO_ATTRIB_GENERIC6,
71    VBO_ATTRIB_GENERIC7,
72    VBO_ATTRIB_GENERIC8,
73    VBO_ATTRIB_GENERIC9,
74    VBO_ATTRIB_GENERIC10,
75    VBO_ATTRIB_GENERIC11,
76    VBO_ATTRIB_GENERIC12,
77    VBO_ATTRIB_GENERIC13,
78    VBO_ATTRIB_GENERIC14,
79    VBO_ATTRIB_GENERIC15,
80 
81    /* XXX: in the vertex program inputs_read flag, we alias
82     * materials and generics and use knowledge about the program
83     * (whether it is a fixed-function emulation) to
84     * differentiate.  Here we must keep them apart instead.
85     */
86    VBO_ATTRIB_MAT_FRONT_AMBIENT,
87    VBO_ATTRIB_MAT_BACK_AMBIENT,
88    VBO_ATTRIB_MAT_FRONT_DIFFUSE,
89    VBO_ATTRIB_MAT_BACK_DIFFUSE,
90    VBO_ATTRIB_MAT_FRONT_SPECULAR,
91    VBO_ATTRIB_MAT_BACK_SPECULAR,
92    VBO_ATTRIB_MAT_FRONT_EMISSION,
93    VBO_ATTRIB_MAT_BACK_EMISSION,
94    VBO_ATTRIB_MAT_FRONT_SHININESS,
95    VBO_ATTRIB_MAT_BACK_SHININESS,
96    VBO_ATTRIB_MAT_FRONT_INDEXES,
97    VBO_ATTRIB_MAT_BACK_INDEXES,
98 
99    VBO_ATTRIB_MAX
100 };
101 
102 #define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
103 #define VBO_ATTRIB_LAST_MATERIAL VBO_ATTRIB_MAT_BACK_INDEXES
104 
105 
106 /** VBO_ATTRIB_POS .. VBO_ATTRIB_POINT_SIZE */
107 #define VBO_ATTRIBS_LEGACY  BITFIELD64_MASK(VBO_ATTRIB_GENERIC0)
108 
109 /** VBO_ATTRIB_MAT_FRONT_AMBIENT .. VBO_ATTRIB_MAT_BACK_INDEXES */
110 #define VBO_ATTRIBS_MATERIALS BITFIELD64_RANGE(VBO_ATTRIB_MAT_FRONT_AMBIENT, \
111                      VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)
112 
113 /** Shift to move legacy material attribs into generic slots */
114 #define VBO_MATERIAL_SHIFT \
115    (VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)
116 
117 
118 
119 #define VBO_MAX_COPIED_VERTS 31
120 
121 #endif
122