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