more compiler warning fixes
[mesa.git] / src / mesa / math / m_translate.c
1 /* $Id: m_translate.c,v 1.9 2001/09/18 23:06:14 kschultz Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27 /*
28 * New (3.1) transformation code written by Keith Whitwell.
29 */
30
31
32 #include "glheader.h"
33 #include "mtypes.h" /* GLchan hack */
34 #include "colormac.h"
35 #include "mem.h"
36 #include "mmath.h"
37
38 #include "m_translate.h"
39
40
41
42 typedef void (*trans_1f_func)(GLfloat *to,
43 CONST void *ptr,
44 GLuint stride,
45 GLuint start,
46 GLuint n );
47
48 typedef void (*trans_1ui_func)(GLuint *to,
49 CONST void *ptr,
50 GLuint stride,
51 GLuint start,
52 GLuint n );
53
54 typedef void (*trans_1ub_func)(GLubyte *to,
55 CONST void *ptr,
56 GLuint stride,
57 GLuint start,
58 GLuint n );
59
60 typedef void (*trans_4ub_func)(GLubyte (*to)[4],
61 CONST void *ptr,
62 GLuint stride,
63 GLuint start,
64 GLuint n );
65
66 typedef void (*trans_4us_func)(GLushort (*to)[4],
67 CONST void *ptr,
68 GLuint stride,
69 GLuint start,
70 GLuint n );
71
72 typedef void (*trans_4f_func)(GLfloat (*to)[4],
73 CONST void *ptr,
74 GLuint stride,
75 GLuint start,
76 GLuint n );
77
78 typedef void (*trans_3f_func)(GLfloat (*to)[3],
79 CONST void *ptr,
80 GLuint stride,
81 GLuint start,
82 GLuint n );
83
84
85
86
87 #define TYPE_IDX(t) ((t) & 0xf)
88 #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
89
90
91 /* This macro is used on other systems, so undefine it for this module */
92
93 #undef CHECK
94
95 static trans_1f_func _math_trans_1f_tab[MAX_TYPES];
96 static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES];
97 static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES];
98 static trans_3f_func _math_trans_3f_tab[MAX_TYPES];
99 static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES];
100 static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES];
101 static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES];
102
103
104 #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt])
105
106
107 #define TAB(x) _math_trans##x##_tab
108 #define ARGS GLuint start, GLuint n
109 #define SRC_START start
110 #define DST_START 0
111 #define STRIDE stride
112 #define NEXT_F f += stride
113 #define NEXT_F2
114 #define CHECK
115
116
117
118
119 /* GL_BYTE
120 */
121 #define SRC GLbyte
122 #define SRC_IDX TYPE_IDX(GL_BYTE)
123 #define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) )
124 #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) )
125 #define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) )
126 #define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) )
127 #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
128
129
130 #define SZ 4
131 #define INIT init_trans_4_GLbyte_raw
132 #define DEST_4F trans_4_GLbyte_4f_raw
133 #define DEST_4UB trans_4_GLbyte_4ub_raw
134 #define DEST_4US trans_4_GLbyte_4us_raw
135 #include "m_trans_tmp.h"
136
137 #define SZ 3
138 #define INIT init_trans_3_GLbyte_raw
139 #define DEST_4F trans_3_GLbyte_4f_raw
140 #define DEST_4UB trans_3_GLbyte_4ub_raw
141 #define DEST_4US trans_3_GLbyte_4us_raw
142 #define DEST_3F trans_3_GLbyte_3f_raw
143 #include "m_trans_tmp.h"
144
145 #define SZ 2
146 #define INIT init_trans_2_GLbyte_raw
147 #define DEST_4F trans_2_GLbyte_4f_raw
148 #include "m_trans_tmp.h"
149
150 #define SZ 1
151 #define INIT init_trans_1_GLbyte_raw
152 #define DEST_4F trans_1_GLbyte_4f_raw
153 #define DEST_1UB trans_1_GLbyte_1ub_raw
154 #define DEST_1UI trans_1_GLbyte_1ui_raw
155 #include "m_trans_tmp.h"
156
157 #undef SRC
158 #undef TRX_3F
159 #undef TRX_4F
160 #undef TRX_UB
161 #undef TRX_US
162 #undef TRX_UI
163 #undef SRC_IDX
164
165
166 /* GL_UNSIGNED_BYTE
167 */
168 #define SRC GLubyte
169 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE)
170 #define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
171 #define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
172 #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n)
173 #define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n))
174 #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n)
175
176 /* 4ub->4ub handled in special case below.
177 */
178 #define SZ 4
179 #define INIT init_trans_4_GLubyte_raw
180 #define DEST_4F trans_4_GLubyte_4f_raw
181 #define DEST_4US trans_4_GLubyte_4us_raw
182 #include "m_trans_tmp.h"
183
184
185 #define SZ 3
186 #define INIT init_trans_3_GLubyte_raw
187 #define DEST_4UB trans_3_GLubyte_4ub_raw
188 #define DEST_4US trans_3_GLubyte_4us_raw
189 #define DEST_3F trans_3_GLubyte_3f_raw
190 #define DEST_4F trans_3_GLubyte_4f_raw
191 #include "m_trans_tmp.h"
192
193
194 #define SZ 1
195 #define INIT init_trans_1_GLubyte_raw
196 #define DEST_1UI trans_1_GLubyte_1ui_raw
197 #define DEST_1UB trans_1_GLubyte_1ub_raw
198 #include "m_trans_tmp.h"
199
200 #undef SRC
201 #undef SRC_IDX
202 #undef TRX_3F
203 #undef TRX_4F
204 #undef TRX_UB
205 #undef TRX_US
206 #undef TRX_UI
207
208
209 /* GL_SHORT
210 */
211 #define SRC GLshort
212 #define SRC_IDX TYPE_IDX(GL_SHORT)
213 #define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) )
214 #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
215 #define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n))
216 #define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n))
217 #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
218
219
220 #define SZ 4
221 #define INIT init_trans_4_GLshort_raw
222 #define DEST_4F trans_4_GLshort_4f_raw
223 #define DEST_4UB trans_4_GLshort_4ub_raw
224 #define DEST_4US trans_4_GLshort_4us_raw
225 #include "m_trans_tmp.h"
226
227 #define SZ 3
228 #define INIT init_trans_3_GLshort_raw
229 #define DEST_4F trans_3_GLshort_4f_raw
230 #define DEST_4UB trans_3_GLshort_4ub_raw
231 #define DEST_4US trans_3_GLshort_4us_raw
232 #define DEST_3F trans_3_GLshort_3f_raw
233 #include "m_trans_tmp.h"
234
235 #define SZ 2
236 #define INIT init_trans_2_GLshort_raw
237 #define DEST_4F trans_2_GLshort_4f_raw
238 #include "m_trans_tmp.h"
239
240 #define SZ 1
241 #define INIT init_trans_1_GLshort_raw
242 #define DEST_4F trans_1_GLshort_4f_raw
243 #define DEST_1UB trans_1_GLshort_1ub_raw
244 #define DEST_1UI trans_1_GLshort_1ui_raw
245 #include "m_trans_tmp.h"
246
247
248 #undef SRC
249 #undef SRC_IDX
250 #undef TRX_3F
251 #undef TRX_4F
252 #undef TRX_UB
253 #undef TRX_US
254 #undef TRX_UI
255
256
257 /* GL_UNSIGNED_SHORT
258 */
259 #define SRC GLushort
260 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT)
261 #define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) )
262 #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
263 #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8)
264 #define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8)
265 #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n)
266
267
268 #define SZ 4
269 #define INIT init_trans_4_GLushort_raw
270 #define DEST_4F trans_4_GLushort_4f_raw
271 #define DEST_4UB trans_4_GLushort_4ub_raw
272 #define DEST_4US trans_4_GLushort_4us_raw
273 #include "m_trans_tmp.h"
274
275 #define SZ 3
276 #define INIT init_trans_3_GLushort_raw
277 #define DEST_4F trans_3_GLushort_4f_raw
278 #define DEST_4UB trans_3_GLushort_4ub_raw
279 #define DEST_4US trans_3_GLushort_4us_raw
280 #define DEST_3F trans_3_GLushort_3f_raw
281 #include "m_trans_tmp.h"
282
283 #define SZ 2
284 #define INIT init_trans_2_GLushort_raw
285 #define DEST_4F trans_2_GLushort_4f_raw
286 #include "m_trans_tmp.h"
287
288 #define SZ 1
289 #define INIT init_trans_1_GLushort_raw
290 #define DEST_4F trans_1_GLushort_4f_raw
291 #define DEST_1UB trans_1_GLushort_1ub_raw
292 #define DEST_1UI trans_1_GLushort_1ui_raw
293 #include "m_trans_tmp.h"
294
295 #undef SRC
296 #undef SRC_IDX
297 #undef TRX_3F
298 #undef TRX_4F
299 #undef TRX_UB
300 #undef TRX_US
301 #undef TRX_UI
302
303
304 /* GL_INT
305 */
306 #define SRC GLint
307 #define SRC_IDX TYPE_IDX(GL_INT)
308 #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) )
309 #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
310 #define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n))
311 #define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n))
312 #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n))
313
314
315 #define SZ 4
316 #define INIT init_trans_4_GLint_raw
317 #define DEST_4F trans_4_GLint_4f_raw
318 #define DEST_4UB trans_4_GLint_4ub_raw
319 #define DEST_4US trans_4_GLint_4us_raw
320 #include "m_trans_tmp.h"
321
322 #define SZ 3
323 #define INIT init_trans_3_GLint_raw
324 #define DEST_4F trans_3_GLint_4f_raw
325 #define DEST_4UB trans_3_GLint_4ub_raw
326 #define DEST_4US trans_3_GLint_4us_raw
327 #define DEST_3F trans_3_GLint_3f_raw
328 #include "m_trans_tmp.h"
329
330 #define SZ 2
331 #define INIT init_trans_2_GLint_raw
332 #define DEST_4F trans_2_GLint_4f_raw
333 #include "m_trans_tmp.h"
334
335 #define SZ 1
336 #define INIT init_trans_1_GLint_raw
337 #define DEST_4F trans_1_GLint_4f_raw
338 #define DEST_1UB trans_1_GLint_1ub_raw
339 #define DEST_1UI trans_1_GLint_1ui_raw
340 #include "m_trans_tmp.h"
341
342
343 #undef SRC
344 #undef SRC_IDX
345 #undef TRX_3F
346 #undef TRX_4F
347 #undef TRX_UB
348 #undef TRX_US
349 #undef TRX_UI
350
351
352 /* GL_UNSIGNED_INT
353 */
354 #define SRC GLuint
355 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT)
356 #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) )
357 #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
358 #define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24)
359 #define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16)
360 #define TRX_UI(f,n) PTR_ELT(f,n)
361
362
363 #define SZ 4
364 #define INIT init_trans_4_GLuint_raw
365 #define DEST_4F trans_4_GLuint_4f_raw
366 #define DEST_4UB trans_4_GLuint_4ub_raw
367 #define DEST_4US trans_4_GLuint_4us_raw
368 #include "m_trans_tmp.h"
369
370 #define SZ 3
371 #define INIT init_trans_3_GLuint_raw
372 #define DEST_4F trans_3_GLuint_4f_raw
373 #define DEST_4UB trans_3_GLuint_4ub_raw
374 #define DEST_4US trans_3_GLuint_4us_raw
375 #define DEST_3F trans_3_GLuint_3f_raw
376 #include "m_trans_tmp.h"
377
378 #define SZ 2
379 #define INIT init_trans_2_GLuint_raw
380 #define DEST_4F trans_2_GLuint_4f_raw
381 #include "m_trans_tmp.h"
382
383 #define SZ 1
384 #define INIT init_trans_1_GLuint_raw
385 #define DEST_4F trans_1_GLuint_4f_raw
386 #define DEST_1UB trans_1_GLuint_1ub_raw
387 #define DEST_1UI trans_1_GLuint_1ui_raw
388 #include "m_trans_tmp.h"
389
390 #undef SRC
391 #undef SRC_IDX
392 #undef TRX_3F
393 #undef TRX_4F
394 #undef TRX_UB
395 #undef TRX_US
396 #undef TRX_UI
397
398
399 /* GL_DOUBLE
400 */
401 #define SRC GLdouble
402 #define SRC_IDX TYPE_IDX(GL_DOUBLE)
403 #define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n)
404 #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n)
405 #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n))
406 #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n))
407 #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n)
408 #define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n)
409
410
411 #define SZ 4
412 #define INIT init_trans_4_GLdouble_raw
413 #define DEST_4F trans_4_GLdouble_4f_raw
414 #define DEST_4UB trans_4_GLdouble_4ub_raw
415 #define DEST_4US trans_4_GLdouble_4us_raw
416 #include "m_trans_tmp.h"
417
418 #define SZ 3
419 #define INIT init_trans_3_GLdouble_raw
420 #define DEST_4F trans_3_GLdouble_4f_raw
421 #define DEST_4UB trans_3_GLdouble_4ub_raw
422 #define DEST_4US trans_3_GLdouble_4us_raw
423 #define DEST_3F trans_3_GLdouble_3f_raw
424 #include "m_trans_tmp.h"
425
426 #define SZ 2
427 #define INIT init_trans_2_GLdouble_raw
428 #define DEST_4F trans_2_GLdouble_4f_raw
429 #include "m_trans_tmp.h"
430
431 #define SZ 1
432 #define INIT init_trans_1_GLdouble_raw
433 #define DEST_4F trans_1_GLdouble_4f_raw
434 #define DEST_1UB trans_1_GLdouble_1ub_raw
435 #define DEST_1UI trans_1_GLdouble_1ui_raw
436 #define DEST_1F trans_1_GLdouble_1f_raw
437 #include "m_trans_tmp.h"
438
439 #undef SRC
440 #undef SRC_IDX
441
442 /* GL_FLOAT
443 */
444 #define SRC GLfloat
445 #define SRC_IDX TYPE_IDX(GL_FLOAT)
446 #define SZ 4
447 #define INIT init_trans_4_GLfloat_raw
448 #define DEST_4UB trans_4_GLfloat_4ub_raw
449 #define DEST_4US trans_4_GLfloat_4us_raw
450 #define DEST_4F trans_4_GLfloat_4f_raw
451 #include "m_trans_tmp.h"
452
453 #define SZ 3
454 #define INIT init_trans_3_GLfloat_raw
455 #define DEST_4F trans_3_GLfloat_4f_raw
456 #define DEST_4UB trans_3_GLfloat_4ub_raw
457 #define DEST_4US trans_3_GLfloat_4us_raw
458 #define DEST_3F trans_3_GLfloat_3f_raw
459 #include "m_trans_tmp.h"
460
461 #define SZ 2
462 #define INIT init_trans_2_GLfloat_raw
463 #define DEST_4F trans_2_GLfloat_4f_raw
464 #include "m_trans_tmp.h"
465
466 #define SZ 1
467 #define INIT init_trans_1_GLfloat_raw
468 #define DEST_4F trans_1_GLfloat_4f_raw
469 #define DEST_1UB trans_1_GLfloat_1ub_raw
470 #define DEST_1UI trans_1_GLfloat_1ui_raw
471 #define DEST_1F trans_1_GLfloat_1f_raw
472
473 #include "m_trans_tmp.h"
474
475 #undef SRC
476 #undef SRC_IDX
477 #undef TRX_3F
478 #undef TRX_4F
479 #undef TRX_UB
480 #undef TRX_US
481 #undef TRX_UI
482
483
484 static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4],
485 CONST void *Ptr,
486 GLuint stride,
487 ARGS )
488 {
489 const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride;
490 GLuint i;
491
492 if (((((long) f | (long) stride)) & 3L) == 0L) {
493 /* Aligned.
494 */
495 for (i = DST_START ; i < n ; i++, f += stride) {
496 COPY_4UBV( t[i], f );
497 }
498 } else {
499 for (i = DST_START ; i < n ; i++, f += stride) {
500 t[i][0] = f[0];
501 t[i][1] = f[1];
502 t[i][2] = f[2];
503 t[i][3] = f[3];
504 }
505 }
506 }
507
508
509 static void init_translate_raw(void)
510 {
511 MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) );
512 MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) );
513 MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) );
514 MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) );
515 MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) );
516 MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) );
517
518 init_trans_4_GLbyte_raw();
519 init_trans_3_GLbyte_raw();
520 init_trans_2_GLbyte_raw();
521 init_trans_1_GLbyte_raw();
522 init_trans_1_GLubyte_raw();
523 init_trans_3_GLubyte_raw();
524 init_trans_4_GLubyte_raw();
525 init_trans_4_GLshort_raw();
526 init_trans_3_GLshort_raw();
527 init_trans_2_GLshort_raw();
528 init_trans_1_GLshort_raw();
529 init_trans_4_GLushort_raw();
530 init_trans_3_GLushort_raw();
531 init_trans_2_GLushort_raw();
532 init_trans_1_GLushort_raw();
533 init_trans_4_GLint_raw();
534 init_trans_3_GLint_raw();
535 init_trans_2_GLint_raw();
536 init_trans_1_GLint_raw();
537 init_trans_4_GLuint_raw();
538 init_trans_3_GLuint_raw();
539 init_trans_2_GLuint_raw();
540 init_trans_1_GLuint_raw();
541 init_trans_4_GLdouble_raw();
542 init_trans_3_GLdouble_raw();
543 init_trans_2_GLdouble_raw();
544 init_trans_1_GLdouble_raw();
545 init_trans_4_GLfloat_raw();
546 init_trans_3_GLfloat_raw();
547 init_trans_2_GLfloat_raw();
548 init_trans_1_GLfloat_raw();
549
550 TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
551 }
552
553
554 #undef TAB
555 #undef CLASS
556 #undef ARGS
557 #undef CHECK
558 #undef SRC_START
559 #undef DST_START
560 #undef NEXT_F
561 #undef NEXT_F2
562
563
564
565
566
567 void _math_init_translate( void )
568 {
569 init_translate_raw();
570 }
571
572
573
574 void _math_trans_1f(GLfloat *to,
575 CONST void *ptr,
576 GLuint stride,
577 GLenum type,
578 GLuint start,
579 GLuint n )
580 {
581 _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
582 }
583
584 void _math_trans_1ui(GLuint *to,
585 CONST void *ptr,
586 GLuint stride,
587 GLenum type,
588 GLuint start,
589 GLuint n )
590 {
591 _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
592 }
593
594 void _math_trans_1ub(GLubyte *to,
595 CONST void *ptr,
596 GLuint stride,
597 GLenum type,
598 GLuint start,
599 GLuint n )
600 {
601 _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
602 }
603
604
605 void _math_trans_4ub(GLubyte (*to)[4],
606 CONST void *ptr,
607 GLuint stride,
608 GLenum type,
609 GLuint size,
610 GLuint start,
611 GLuint n )
612 {
613 _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
614 }
615
616 void _math_trans_4chan( GLchan (*to)[4],
617 CONST void *ptr,
618 GLuint stride,
619 GLenum type,
620 GLuint size,
621 GLuint start,
622 GLuint n )
623 {
624 #if CHAN_TYPE == GL_UNSIGNED_BYTE
625 _math_trans_4ub( to, ptr, stride, type, size, start, n );
626 #elif CHAN_TYPE == GL_UNSIGNED_SHORT
627 _math_trans_4us( to, ptr, stride, type, size, start, n );
628 #elif CHAN_TYPE == GL_FLOAT
629 _math_trans_4f( to, ptr, stride, type, size, start, n );
630 #endif
631 }
632
633 void _math_trans_4us(GLushort (*to)[4],
634 CONST void *ptr,
635 GLuint stride,
636 GLenum type,
637 GLuint size,
638 GLuint start,
639 GLuint n )
640 {
641 _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
642 }
643
644 void _math_trans_4f(GLfloat (*to)[4],
645 CONST void *ptr,
646 GLuint stride,
647 GLenum type,
648 GLuint size,
649 GLuint start,
650 GLuint n )
651 {
652 _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
653 }
654
655 void _math_trans_3f(GLfloat (*to)[3],
656 CONST void *ptr,
657 GLuint stride,
658 GLenum type,
659 GLuint start,
660 GLuint n )
661 {
662 _math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
663 }