silence some warnings (Evgeny Kotsuba)
[mesa.git] / src / mesa / math / m_trans_tmp.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 5.1
4 *
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /*
26 * New (3.1) transformation code written by Keith Whitwell.
27 */
28
29
30 /* KW: This file also included by tnl/trans_elt.c to build code
31 * specific to the implementation of array-elements in the
32 * tnl module.
33 */
34
35
36 #ifdef DEST_4F
37 static void DEST_4F( GLfloat (*t)[4],
38 CONST void *ptr,
39 GLuint stride,
40 ARGS )
41 {
42 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
43 const GLubyte *first = f;
44 GLuint i;
45
46 (void) first;
47 (void) start;
48 for (i = DST_START ; i < n ; i++, NEXT_F) {
49 CHECK {
50 NEXT_F2;
51 if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
52 if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
53 if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
54 if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
55 }
56 }
57 }
58 #endif
59
60
61 #ifdef DEST_3F
62 static void DEST_3F( GLfloat (*t)[3],
63 CONST void *ptr,
64 GLuint stride,
65 ARGS )
66 {
67 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
68 const GLubyte *first = f;
69 GLuint i;
70 (void) first;
71 (void) start;
72 for (i = DST_START ; i < n ; i++, NEXT_F) {
73 CHECK {
74 NEXT_F2;
75 t[i][0] = TRX_3F(f, 0);
76 t[i][1] = TRX_3F(f, 1);
77 t[i][2] = TRX_3F(f, 2);
78 }
79 }
80 }
81 #endif
82
83 #ifdef DEST_1F
84 static void DEST_1F( GLfloat *t,
85 CONST void *ptr,
86 GLuint stride,
87 ARGS )
88 {
89 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
90 const GLubyte *first = f;
91 GLuint i;
92 (void) first;
93 (void) start;
94 for (i = DST_START ; i < n ; i++, NEXT_F) {
95 CHECK {
96 NEXT_F2;
97 t[i] = TRX_1F(f, 0);
98 }
99 }
100 }
101 #endif
102
103 #ifdef DEST_4UB
104 static void DEST_4UB( GLubyte (*t)[4],
105 CONST void *ptr,
106 GLuint stride,
107 ARGS )
108 {
109 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
110 const GLubyte *first = f;
111 GLuint i;
112 (void) start;
113 (void) first;
114 for (i = DST_START ; i < n ; i++, NEXT_F) {
115 CHECK {
116 NEXT_F2;
117 if (SZ >= 1) TRX_UB(t[i][0], f, 0);
118 if (SZ >= 2) TRX_UB(t[i][1], f, 1);
119 if (SZ >= 3) TRX_UB(t[i][2], f, 2);
120 if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
121 }
122 }
123 }
124 #endif
125
126
127 #ifdef DEST_4US
128 static void DEST_4US( GLushort (*t)[4],
129 CONST void *ptr,
130 GLuint stride,
131 ARGS )
132 {
133 const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride);
134 const GLubyte *first = f;
135 GLuint i;
136 (void) start;
137 (void) first;
138 for (i = DST_START ; i < n ; i++, NEXT_F) {
139 CHECK {
140 NEXT_F2;
141 if (SZ >= 1) TRX_US(t[i][0], f, 0);
142 if (SZ >= 2) TRX_US(t[i][1], f, 1);
143 if (SZ >= 3) TRX_US(t[i][2], f, 2);
144 if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
145 }
146 }
147 }
148 #endif
149
150
151 #ifdef DEST_1UB
152 static void DEST_1UB( GLubyte *t,
153 CONST void *ptr,
154 GLuint stride,
155 ARGS )
156 {
157 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
158 const GLubyte *first = f;
159 GLuint i;
160 (void) start;
161 (void) first;
162 for (i = DST_START ; i < n ; i++, NEXT_F) {
163 CHECK {
164 NEXT_F2;
165 TRX_UB(t[i], f, 0);
166 }
167 }
168 }
169 #endif
170
171
172 #ifdef DEST_1UI
173 static void DEST_1UI( GLuint *t,
174 CONST void *ptr,
175 GLuint stride,
176 ARGS )
177 {
178 const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
179 const GLubyte *first = f;
180 GLuint i;
181 (void) start;
182 (void) first;
183
184 for (i = DST_START ; i < n ; i++, NEXT_F) {
185 CHECK {
186 NEXT_F2;
187 t[i] = TRX_UI(f, 0);
188 }
189 }
190 }
191 #endif
192
193
194 static void INIT(void)
195 {
196 #ifdef DEST_1UI
197 ASSERT(SZ == 1);
198 TAB(_1ui)[SRC_IDX] = DEST_1UI;
199 #endif
200 #ifdef DEST_1UB
201 ASSERT(SZ == 1);
202 TAB(_1ub)[SRC_IDX] = DEST_1UB;
203 #endif
204 #ifdef DEST_1F
205 ASSERT(SZ == 1);
206 TAB(_1f)[SRC_IDX] = DEST_1F;
207 #endif
208 #ifdef DEST_3F
209 ASSERT(SZ == 3);
210 TAB(_3f)[SRC_IDX] = DEST_3F;
211 #endif
212 #ifdef DEST_4UB
213 TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB;
214 #endif
215 #ifdef DEST_4US
216 TAB(_4us)[SZ][SRC_IDX] = DEST_4US;
217 #endif
218 #ifdef DEST_4F
219 TAB(_4f)[SZ][SRC_IDX] = DEST_4F;
220 #endif
221
222 }
223
224
225 #ifdef INIT
226 #undef INIT
227 #endif
228 #ifdef DEST_1UI
229 #undef DEST_1UI
230 #endif
231 #ifdef DEST_1UB
232 #undef DEST_1UB
233 #endif
234 #ifdef DEST_4UB
235 #undef DEST_4UB
236 #endif
237 #ifdef DEST_4US
238 #undef DEST_4US
239 #endif
240 #ifdef DEST_3F
241 #undef DEST_3F
242 #endif
243 #ifdef DEST_4F
244 #undef DEST_4F
245 #endif
246 #ifdef DEST_1F
247 #undef DEST_1F
248 #endif
249 #ifdef SZ
250 #undef SZ
251 #endif
252 #ifdef TAG
253 #undef TAG
254 #endif
255