remove unused vars
[mesa.git] / src / mesa / tnl_dd / t_dd_unfilled.h
1
2 /*
3 * Mesa 3-D graphics library
4 * Version: 3.5
5 *
6 * Copyright (C) 1999-2001 Brian Paul 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 * Authors:
26 * Keith Whitwell <keith@tungstengraphics.com>
27 */
28
29 #if HAVE_RGBA
30 #define VERT_SET_IND( v, c )
31 #define VERT_COPY_IND( v0, v1 )
32 #define VERT_SAVE_IND( idx )
33 #define VERT_RESTORE_IND( idx )
34 #endif
35
36 #if !HAVE_SPEC
37 #define VERT_SET_SPEC( v, c )
38 #define VERT_COPY_SPEC( v0, v1 )
39 #define VERT_SAVE_SPEC( idx )
40 #define VERT_RESTORE_SPEC( idx )
41 #endif
42
43 static void TAG(unfilled_tri)( GLcontext *ctx,
44 GLenum mode,
45 GLuint e0, GLuint e1, GLuint e2 )
46 {
47 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
48 GLubyte *ef = VB->EdgeFlag;
49 VERTEX *v[3];
50 LOCAL_VARS(3);
51
52 v[0] = (VERTEX *)GET_VERTEX(e0);
53 v[1] = (VERTEX *)GET_VERTEX(e1);
54 v[2] = (VERTEX *)GET_VERTEX(e2);
55
56 if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
57 if (HAVE_RGBA) {
58 VERT_SAVE_RGBA(0);
59 VERT_SAVE_RGBA(1);
60 VERT_COPY_RGBA(v[0], v[2]);
61 VERT_COPY_RGBA(v[1], v[2]);
62
63 if (HAVE_SPEC) {
64 VERT_SAVE_SPEC(0);
65 VERT_SAVE_SPEC(1);
66 VERT_COPY_SPEC(v[0], v[2]);
67 VERT_COPY_SPEC(v[1], v[2]);
68 }
69 } else {
70 VERT_SAVE_IND(0);
71 VERT_SAVE_IND(1);
72 VERT_COPY_IND(v[0], v[2]);
73 VERT_COPY_IND(v[1], v[2]);
74 }
75 }
76
77 /* fprintf(stderr, "%s %s %d %d %d\n", __FUNCTION__, */
78 /* _mesa_lookup_enum_by_nr( mode ), */
79 /* ef[e0], ef[e1], ef[e2]); */
80
81 if (mode == GL_POINT) {
82 RASTERIZE(GL_POINTS);
83 if (ef[e0]) POINT( v[0] );
84 if (ef[e1]) POINT( v[1] );
85 if (ef[e2]) POINT( v[2] );
86 }
87 else {
88 RASTERIZE(GL_LINES);
89 if (RENDER_PRIMITIVE == GL_POLYGON) {
90 if (ef[e2]) LINE( v[2], v[0] );
91 if (ef[e0]) LINE( v[0], v[1] );
92 if (ef[e1]) LINE( v[1], v[2] );
93 }
94 else {
95 if (ef[e0]) LINE( v[0], v[1] );
96 if (ef[e1]) LINE( v[1], v[2] );
97 if (ef[e2]) LINE( v[2], v[0] );
98 }
99 }
100
101 if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
102 if (HAVE_RGBA) {
103 VERT_RESTORE_RGBA(0);
104 VERT_RESTORE_RGBA(1);
105
106 if (HAVE_SPEC) {
107 VERT_RESTORE_SPEC(0);
108 VERT_RESTORE_SPEC(1);
109 }
110 } else {
111 VERT_RESTORE_IND(0);
112 VERT_RESTORE_IND(1);
113 }
114 }
115 }
116
117
118 static void TAG(unfilled_quad)( GLcontext *ctx,
119 GLenum mode,
120 GLuint e0, GLuint e1,
121 GLuint e2, GLuint e3 )
122 {
123 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
124 GLubyte *ef = VB->EdgeFlag;
125 VERTEX *v[4];
126 LOCAL_VARS(4);
127
128 v[0] = (VERTEX *)GET_VERTEX(e0);
129 v[1] = (VERTEX *)GET_VERTEX(e1);
130 v[2] = (VERTEX *)GET_VERTEX(e2);
131 v[3] = (VERTEX *)GET_VERTEX(e3);
132
133 /* Hardware flatshading breaks down here. If the hardware doesn't
134 * support flatshading, this will already have been done:
135 */
136 if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
137 if (HAVE_RGBA) {
138 VERT_SAVE_RGBA(0);
139 VERT_SAVE_RGBA(1);
140 VERT_SAVE_RGBA(2);
141 VERT_COPY_RGBA(v[0], v[3]);
142 VERT_COPY_RGBA(v[1], v[3]);
143 VERT_COPY_RGBA(v[2], v[3]);
144
145 if (HAVE_SPEC) {
146 VERT_SAVE_SPEC(0);
147 VERT_SAVE_SPEC(1);
148 VERT_SAVE_SPEC(2);
149 VERT_COPY_SPEC(v[0], v[3]);
150 VERT_COPY_SPEC(v[1], v[3]);
151 VERT_COPY_SPEC(v[2], v[3]);
152 }
153 } else {
154 VERT_SAVE_IND(0);
155 VERT_SAVE_IND(1);
156 VERT_SAVE_IND(2);
157 VERT_COPY_IND(v[0], v[3]);
158 VERT_COPY_IND(v[1], v[3]);
159 VERT_COPY_IND(v[2], v[3]);
160 }
161 }
162
163 if (mode == GL_POINT) {
164 RASTERIZE(GL_POINTS);
165 if (ef[e0]) POINT( v[0] );
166 if (ef[e1]) POINT( v[1] );
167 if (ef[e2]) POINT( v[2] );
168 if (ef[e3]) POINT( v[3] );
169 }
170 else {
171 RASTERIZE(GL_LINES);
172 if (ef[e0]) LINE( v[0], v[1] );
173 if (ef[e1]) LINE( v[1], v[2] );
174 if (ef[e2]) LINE( v[2], v[3] );
175 if (ef[e3]) LINE( v[3], v[0] );
176 }
177
178 if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
179 if (HAVE_RGBA) {
180 VERT_RESTORE_RGBA(0);
181 VERT_RESTORE_RGBA(1);
182 VERT_RESTORE_RGBA(2);
183
184 if (HAVE_SPEC) {
185 VERT_RESTORE_SPEC(0);
186 VERT_RESTORE_SPEC(1);
187 VERT_RESTORE_SPEC(2);
188 }
189 } else {
190 VERT_RESTORE_IND(0);
191 VERT_RESTORE_IND(1);
192 VERT_RESTORE_IND(2);
193 }
194 }
195 }
196
197
198 #if HAVE_RGBA
199 #undef VERT_SET_IND
200 #undef VERT_COPY_IND
201 #undef VERT_SAVE_IND
202 #undef VERT_RESTORE_IND
203 #endif
204
205 #if !HAVE_SPEC
206 #undef VERT_SET_SPEC
207 #undef VERT_COPY_SPEC
208 #undef VERT_SAVE_SPEC
209 #undef VERT_RESTORE_SPEC
210 #endif
211
212 #undef TAG