f168b6605b32e5050ee8e6169fad9157c67d24ea
[mesa.git] / main / mtypes.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.7
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /**
27 * \file mtypes.h
28 * Main Mesa data structures.
29 *
30 * Please try to mark derived values with a leading underscore ('_').
31 */
32
33 #ifndef MTYPES_H
34 #define MTYPES_H
35
36 #define MAX_DRAW_BUFFERS 8
37 #define MAX_VARYING 16
38
39 /**
40 * Indexes for vertex program attributes.
41 * GL_NV_vertex_program aliases generic attributes over the conventional
42 * attributes. In GL_ARB_vertex_program shader the aliasing is optional.
43 * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
44 * generic attributes are distinct/separate).
45 */
46 typedef enum
47 {
48 VERT_ATTRIB_POS = 0,
49 VERT_ATTRIB_WEIGHT = 1,
50 VERT_ATTRIB_NORMAL = 2,
51 VERT_ATTRIB_COLOR0 = 3,
52 VERT_ATTRIB_COLOR1 = 4,
53 VERT_ATTRIB_FOG = 5,
54 VERT_ATTRIB_COLOR_INDEX = 6,
55 VERT_ATTRIB_POINT_SIZE = 6, /*alias*/
56 VERT_ATTRIB_EDGEFLAG = 7,
57 VERT_ATTRIB_TEX0 = 8,
58 VERT_ATTRIB_TEX1 = 9,
59 VERT_ATTRIB_TEX2 = 10,
60 VERT_ATTRIB_TEX3 = 11,
61 VERT_ATTRIB_TEX4 = 12,
62 VERT_ATTRIB_TEX5 = 13,
63 VERT_ATTRIB_TEX6 = 14,
64 VERT_ATTRIB_TEX7 = 15,
65 VERT_ATTRIB_GENERIC0 = 16,
66 VERT_ATTRIB_GENERIC1 = 17,
67 VERT_ATTRIB_GENERIC2 = 18,
68 VERT_ATTRIB_GENERIC3 = 19,
69 VERT_ATTRIB_GENERIC4 = 20,
70 VERT_ATTRIB_GENERIC5 = 21,
71 VERT_ATTRIB_GENERIC6 = 22,
72 VERT_ATTRIB_GENERIC7 = 23,
73 VERT_ATTRIB_GENERIC8 = 24,
74 VERT_ATTRIB_GENERIC9 = 25,
75 VERT_ATTRIB_GENERIC10 = 26,
76 VERT_ATTRIB_GENERIC11 = 27,
77 VERT_ATTRIB_GENERIC12 = 28,
78 VERT_ATTRIB_GENERIC13 = 29,
79 VERT_ATTRIB_GENERIC14 = 30,
80 VERT_ATTRIB_GENERIC15 = 31,
81 VERT_ATTRIB_MAX = 32
82 } gl_vert_attrib;
83
84 /**
85 * Bitflags for vertex attributes.
86 * These are used in bitfields in many places.
87 */
88 /*@{*/
89 #define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
90 #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
91 #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
92 #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
93 #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
94 #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
95 #define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
96 #define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG)
97 #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
98 #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
99 #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
100 #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
101 #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
102 #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
103 #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
104 #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
105 #define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
106 #define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
107 #define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
108 #define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
109 #define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
110 #define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
111 #define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
112 #define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
113 #define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
114 #define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
115 #define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
116 #define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
117 #define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
118 #define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
119 #define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
120 #define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
121
122 #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
123 #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
124 /*@}*/
125
126
127 /**
128 * Indexes for vertex program result attributes
129 */
130 typedef enum
131 {
132 VERT_RESULT_HPOS = 0,
133 VERT_RESULT_COL0 = 1,
134 VERT_RESULT_COL1 = 2,
135 VERT_RESULT_FOGC = 3,
136 VERT_RESULT_TEX0 = 4,
137 VERT_RESULT_TEX1 = 5,
138 VERT_RESULT_TEX2 = 6,
139 VERT_RESULT_TEX3 = 7,
140 VERT_RESULT_TEX4 = 8,
141 VERT_RESULT_TEX5 = 9,
142 VERT_RESULT_TEX6 = 10,
143 VERT_RESULT_TEX7 = 11,
144 VERT_RESULT_PSIZ = 12,
145 VERT_RESULT_BFC0 = 13,
146 VERT_RESULT_BFC1 = 14,
147 VERT_RESULT_EDGE = 15,
148 VERT_RESULT_VAR0 = 16, /**< shader varying */
149 VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
150 } gl_vert_result;
151
152
153 /**
154 * Indexes for fragment program input attributes.
155 */
156 typedef enum
157 {
158 FRAG_ATTRIB_WPOS = 0,
159 FRAG_ATTRIB_COL0 = 1,
160 FRAG_ATTRIB_COL1 = 2,
161 FRAG_ATTRIB_FOGC = 3,
162 FRAG_ATTRIB_TEX0 = 4,
163 FRAG_ATTRIB_TEX1 = 5,
164 FRAG_ATTRIB_TEX2 = 6,
165 FRAG_ATTRIB_TEX3 = 7,
166 FRAG_ATTRIB_TEX4 = 8,
167 FRAG_ATTRIB_TEX5 = 9,
168 FRAG_ATTRIB_TEX6 = 10,
169 FRAG_ATTRIB_TEX7 = 11,
170 FRAG_ATTRIB_FACE = 12, /**< front/back face */
171 FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */
172 FRAG_ATTRIB_VAR0 = 14, /**< shader varying */
173 FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
174 } gl_frag_attrib;
175
176 /**
177 * Bitflags for fragment program input attributes.
178 */
179 /*@{*/
180 #define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
181 #define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
182 #define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
183 #define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
184 #define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE)
185 #define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC)
186 #define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
187 #define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
188 #define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
189 #define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
190 #define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
191 #define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
192 #define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
193 #define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
194 #define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0)
195
196 #define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U))
197 #define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V))
198
199 #define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
200 FRAG_BIT_TEX1| \
201 FRAG_BIT_TEX2| \
202 FRAG_BIT_TEX3| \
203 FRAG_BIT_TEX4| \
204 FRAG_BIT_TEX5| \
205 FRAG_BIT_TEX6| \
206 FRAG_BIT_TEX7)
207 /*@}*/
208
209
210 /**
211 * Fragment program results
212 */
213 typedef enum
214 {
215 FRAG_RESULT_DEPTH = 0,
216 FRAG_RESULT_COLOR = 1,
217 FRAG_RESULT_DATA0 = 2,
218 FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
219 } gl_frag_result;
220
221 #endif