Checkpoint of new vbo-building code. Currently builds regular arrays
[mesa.git] / src / mesa / vbo / vbo_attrib.h
1 /*
2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) 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 <keith@tungstengraphics.com>
30 */
31
32 #ifndef VBO_ATTRIB_H
33 #define VBO_ATTRIB_H
34
35
36 /*
37 * Note: The first attributes match the VERT_ATTRIB_* definitions
38 * in mtypes.h. However, the tnl module has additional attributes
39 * for materials, color indexes, edge flags, etc.
40 */
41 /* Although it's nice to use these as bit indexes in a DWORD flag, we
42 * could manage without if necessary. Another limit currently is the
43 * number of bits allocated for these numbers in places like vertex
44 * program instruction formats and register layouts.
45 */
46 enum {
47 VBO_ATTRIB_POS = 0,
48 VBO_ATTRIB_WEIGHT = 1,
49 VBO_ATTRIB_NORMAL = 2,
50 VBO_ATTRIB_COLOR0 = 3,
51 VBO_ATTRIB_COLOR1 = 4,
52 VBO_ATTRIB_FOG = 5,
53 VBO_ATTRIB_INDEX = 6,
54 VBO_ATTRIB_EDGEFLAG = 7,
55 VBO_ATTRIB_TEX0 = 8,
56 VBO_ATTRIB_TEX1 = 9,
57 VBO_ATTRIB_TEX2 = 10,
58 VBO_ATTRIB_TEX3 = 11,
59 VBO_ATTRIB_TEX4 = 12,
60 VBO_ATTRIB_TEX5 = 13,
61 VBO_ATTRIB_TEX6 = 14,
62 VBO_ATTRIB_TEX7 = 15,
63
64 VBO_ATTRIB_GENERIC0 = 16, /* Not used? */
65 VBO_ATTRIB_GENERIC1 = 17,
66 VBO_ATTRIB_GENERIC2 = 18,
67 VBO_ATTRIB_GENERIC3 = 19,
68 VBO_ATTRIB_GENERIC4 = 20,
69 VBO_ATTRIB_GENERIC5 = 21,
70 VBO_ATTRIB_GENERIC6 = 22,
71 VBO_ATTRIB_GENERIC7 = 23,
72 VBO_ATTRIB_GENERIC8 = 24,
73 VBO_ATTRIB_GENERIC9 = 25,
74 VBO_ATTRIB_GENERIC10 = 26,
75 VBO_ATTRIB_GENERIC11 = 27,
76 VBO_ATTRIB_GENERIC12 = 28,
77 VBO_ATTRIB_GENERIC13 = 29,
78 VBO_ATTRIB_GENERIC14 = 30,
79 VBO_ATTRIB_GENERIC15 = 31,
80
81 /* XXX: in the vertex program InputsRead 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 = 32,
87 VBO_ATTRIB_MAT_BACK_AMBIENT = 33,
88 VBO_ATTRIB_MAT_FRONT_DIFFUSE = 34,
89 VBO_ATTRIB_MAT_BACK_DIFFUSE = 35,
90 VBO_ATTRIB_MAT_FRONT_SPECULAR = 36,
91 VBO_ATTRIB_MAT_BACK_SPECULAR = 37,
92 VBO_ATTRIB_MAT_FRONT_EMISSION = 38,
93 VBO_ATTRIB_MAT_BACK_EMISSION = 39,
94 VBO_ATTRIB_MAT_FRONT_SHININESS = 40,
95 VBO_ATTRIB_MAT_BACK_SHININESS = 41,
96 VBO_ATTRIB_MAT_FRONT_INDEXES = 42,
97 VBO_ATTRIB_MAT_BACK_INDEXES = 43,
98
99 VBO_ATTRIB_MAX = 44
100 };
101
102 #define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
103
104 #define VBO_MAX_COPIED_VERTS 3
105
106 struct _mesa_prim {
107 GLuint mode:8;
108 GLuint indexed:1;
109 GLuint begin:1;
110 GLuint end:1;
111 GLuint weak:1;
112 GLuint pad:20;
113
114 GLuint start;
115 GLuint count;
116 };
117
118 /* Would like to call this a "vbo_index_buffer", but this would be
119 * confusing as the indices are not neccessarily yet in a non-null
120 * buffer object.
121 */
122 struct _mesa_index_buffer {
123 GLuint count;
124 GLenum type;
125 struct gl_buffer_object *obj;
126 const void *ptr;
127 GLuint rebase;
128 };
129
130
131 #endif