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