12659bd1cf05d4a77b8542ecda52d0d4a2aae0ab
[mesa.git] / src / mesa / drivers / dri / i965 / brw_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 BRW_ATTRIB_H
33 #define BRW_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 BRW_ATTRIB_POS = 0,
48 BRW_ATTRIB_WEIGHT = 1,
49 BRW_ATTRIB_NORMAL = 2,
50 BRW_ATTRIB_COLOR0 = 3,
51 BRW_ATTRIB_COLOR1 = 4,
52 BRW_ATTRIB_FOG = 5,
53 BRW_ATTRIB_INDEX = 6,
54 BRW_ATTRIB_EDGEFLAG = 7,
55 BRW_ATTRIB_TEX0 = 8,
56 BRW_ATTRIB_TEX1 = 9,
57 BRW_ATTRIB_TEX2 = 10,
58 BRW_ATTRIB_TEX3 = 11,
59 BRW_ATTRIB_TEX4 = 12,
60 BRW_ATTRIB_TEX5 = 13,
61 BRW_ATTRIB_TEX6 = 14,
62 BRW_ATTRIB_TEX7 = 15,
63
64 BRW_ATTRIB_GENERIC0 = 16, /* Not used? */
65 BRW_ATTRIB_GENERIC1 = 17,
66 BRW_ATTRIB_GENERIC2 = 18,
67 BRW_ATTRIB_GENERIC3 = 19,
68 BRW_ATTRIB_GENERIC4 = 20,
69 BRW_ATTRIB_GENERIC5 = 21,
70 BRW_ATTRIB_GENERIC6 = 22,
71 BRW_ATTRIB_GENERIC7 = 23,
72 BRW_ATTRIB_GENERIC8 = 24,
73 BRW_ATTRIB_GENERIC9 = 25,
74 BRW_ATTRIB_GENERIC10 = 26,
75 BRW_ATTRIB_GENERIC11 = 27,
76 BRW_ATTRIB_GENERIC12 = 28,
77 BRW_ATTRIB_GENERIC13 = 29,
78 BRW_ATTRIB_GENERIC14 = 30,
79 BRW_ATTRIB_GENERIC15 = 31,
80
81 BRW_ATTRIB_MAT_FRONT_AMBIENT = 32,
82 BRW_ATTRIB_MAT_BACK_AMBIENT = 33,
83 BRW_ATTRIB_MAT_FRONT_DIFFUSE = 34,
84 BRW_ATTRIB_MAT_BACK_DIFFUSE = 35,
85 BRW_ATTRIB_MAT_FRONT_SPECULAR = 36,
86 BRW_ATTRIB_MAT_BACK_SPECULAR = 37,
87 BRW_ATTRIB_MAT_FRONT_EMISSION = 38,
88 BRW_ATTRIB_MAT_BACK_EMISSION = 39,
89 BRW_ATTRIB_MAT_FRONT_SHININESS = 40,
90 BRW_ATTRIB_MAT_BACK_SHININESS = 41,
91 BRW_ATTRIB_MAT_FRONT_INDEXES = 42,
92 BRW_ATTRIB_MAT_BACK_INDEXES = 43,
93
94 BRW_ATTRIB_MAX = 44
95 } ;
96
97 #define BRW_ATTRIB_FIRST_MATERIAL BRW_ATTRIB_MAT_FRONT_AMBIENT
98 #define BRW_ATTRIB_LAST_MATERIAL BRW_ATTRIB_MAT_BACK_INDEXES
99
100 #define BRW_MAX_COPIED_VERTS 3
101
102
103 static inline GLuint64EXT brw_translate_inputs( GLboolean vp_enabled,
104 GLuint mesa_inputs )
105 {
106 GLuint64EXT inputs = mesa_inputs;
107 if (vp_enabled)
108 return inputs;
109 else
110 return (inputs & 0xffff) | ((inputs & 0xffff0000) << 16);
111 }
112
113
114 #endif