1 /* $Id: m_trans_tmp.h,v 1.4 2001/03/12 00:48:41 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
28 * New (3.1) transformation code written by Keith Whitwell.
32 /* KW: This file also included by tnl/trans_elt.c to build code
33 * specific to the implementation of array-elements in the
39 static void DEST_4F( GLfloat (*t
)[4],
44 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
45 const GLubyte
*first
= f
;
50 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
53 if (SZ
>= 1) t
[i
][0] = TRX_4F(f
, 0);
54 if (SZ
>= 2) t
[i
][1] = TRX_4F(f
, 1);
55 if (SZ
>= 3) t
[i
][2] = TRX_4F(f
, 2);
56 if (SZ
== 4) t
[i
][3] = TRX_4F(f
, 3);
64 static void DEST_3F( GLfloat (*t
)[3],
69 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
70 const GLubyte
*first
= f
;
74 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
77 t
[i
][0] = TRX_3F(f
, 0);
78 t
[i
][1] = TRX_3F(f
, 1);
79 t
[i
][2] = TRX_3F(f
, 2);
86 static void DEST_1F( GLfloat
*t
,
91 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
92 const GLubyte
*first
= f
;
96 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
106 static void DEST_4UB( GLubyte (*t
)[4],
111 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
112 const GLubyte
*first
= f
;
116 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
119 if (SZ
>= 1) TRX_UB(t
[i
][0], f
, 0);
120 if (SZ
>= 2) TRX_UB(t
[i
][1], f
, 1);
121 if (SZ
>= 3) TRX_UB(t
[i
][2], f
, 2);
122 if (SZ
== 4) TRX_UB(t
[i
][3], f
, 3); else t
[i
][3] = 255;
130 static void DEST_4US( GLushort (*t
)[4],
135 const GLushort
*f
= (GLushort
*) ptr
+ SRC_START
* stride
;
136 const GLushort
*first
= f
;
140 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
143 if (SZ
>= 1) TRX_US(t
[i
][0], f
, 0);
144 if (SZ
>= 2) TRX_US(t
[i
][1], f
, 1);
145 if (SZ
>= 3) TRX_US(t
[i
][2], f
, 2);
146 if (SZ
== 4) TRX_US(t
[i
][3], f
, 3); else t
[i
][3] = 65535;
154 static void DEST_1UB( GLubyte
*t
,
159 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
160 const GLubyte
*first
= f
;
164 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
175 static void DEST_1UI( GLuint
*t
,
180 const GLubyte
*f
= (GLubyte
*) ptr
+ SRC_START
* stride
;
181 const GLubyte
*first
= f
;
186 for (i
= DST_START
; i
< n
; i
++, NEXT_F
) {
196 static void INIT(void)
200 TAB(_1ui
)[SRC_IDX
] = DEST_1UI
;
204 TAB(_1ub
)[SRC_IDX
] = DEST_1UB
;
208 TAB(_1f
)[SRC_IDX
] = DEST_1F
;
212 TAB(_3f
)[SRC_IDX
] = DEST_3F
;
215 TAB(_4ub
)[SZ
][SRC_IDX
] = DEST_4UB
;
218 TAB(_4us
)[SZ
][SRC_IDX
] = DEST_4US
;
221 TAB(_4f
)[SZ
][SRC_IDX
] = DEST_4F
;