Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
56 | pj | 1 | /* $Id: m_trans_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
2 | |||
3 | /* |
||
4 | * Mesa 3-D graphics library |
||
5 | * Version: 4.0.2 |
||
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 | /* KW: This file also included by tnl/trans_elt.c to build code |
||
33 | * specific to the implementation of array-elements in the |
||
34 | * tnl module. |
||
35 | */ |
||
36 | |||
37 | |||
38 | #ifdef DEST_4F |
||
39 | static void DEST_4F( GLfloat (*t)[4], |
||
40 | CONST void *ptr, |
||
41 | GLuint stride, |
||
42 | ARGS ) |
||
43 | { |
||
44 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
45 | const GLubyte *first = f; |
||
46 | GLuint i; |
||
47 | |||
48 | (void) first; |
||
49 | (void) start; |
||
50 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
51 | CHECK { |
||
52 | NEXT_F2; |
||
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); else t[i][3] = 1.0; |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | #endif |
||
61 | |||
62 | |||
63 | #ifdef DEST_3F |
||
64 | static void DEST_3F( GLfloat (*t)[3], |
||
65 | CONST void *ptr, |
||
66 | GLuint stride, |
||
67 | ARGS ) |
||
68 | { |
||
69 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
70 | const GLubyte *first = f; |
||
71 | GLuint i; |
||
72 | (void) first; |
||
73 | (void) start; |
||
74 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
75 | CHECK { |
||
76 | NEXT_F2; |
||
77 | t[i][0] = TRX_3F(f, 0); |
||
78 | t[i][1] = TRX_3F(f, 1); |
||
79 | t[i][2] = TRX_3F(f, 2); |
||
80 | } |
||
81 | } |
||
82 | } |
||
83 | #endif |
||
84 | |||
85 | #ifdef DEST_1F |
||
86 | static void DEST_1F( GLfloat *t, |
||
87 | CONST void *ptr, |
||
88 | GLuint stride, |
||
89 | ARGS ) |
||
90 | { |
||
91 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
92 | const GLubyte *first = f; |
||
93 | GLuint i; |
||
94 | (void) first; |
||
95 | (void) start; |
||
96 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
97 | CHECK { |
||
98 | NEXT_F2; |
||
99 | t[i] = TRX_1F(f, 0); |
||
100 | } |
||
101 | } |
||
102 | } |
||
103 | #endif |
||
104 | |||
105 | #ifdef DEST_4UB |
||
106 | static void DEST_4UB( GLubyte (*t)[4], |
||
107 | CONST void *ptr, |
||
108 | GLuint stride, |
||
109 | ARGS ) |
||
110 | { |
||
111 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
112 | const GLubyte *first = f; |
||
113 | GLuint i; |
||
114 | (void) start; |
||
115 | (void) first; |
||
116 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
117 | CHECK { |
||
118 | NEXT_F2; |
||
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; |
||
123 | } |
||
124 | } |
||
125 | } |
||
126 | #endif |
||
127 | |||
128 | |||
129 | #ifdef DEST_4US |
||
130 | static void DEST_4US( GLushort (*t)[4], |
||
131 | CONST void *ptr, |
||
132 | GLuint stride, |
||
133 | ARGS ) |
||
134 | { |
||
135 | const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride); |
||
136 | const GLubyte *first = f; |
||
137 | GLuint i; |
||
138 | (void) start; |
||
139 | (void) first; |
||
140 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
141 | CHECK { |
||
142 | NEXT_F2; |
||
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; |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 | #endif |
||
151 | |||
152 | |||
153 | #ifdef DEST_1UB |
||
154 | static void DEST_1UB( GLubyte *t, |
||
155 | CONST void *ptr, |
||
156 | GLuint stride, |
||
157 | ARGS ) |
||
158 | { |
||
159 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
160 | const GLubyte *first = f; |
||
161 | GLuint i; |
||
162 | (void) start; |
||
163 | (void) first; |
||
164 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
165 | CHECK { |
||
166 | NEXT_F2; |
||
167 | TRX_UB(t[i], f, 0); |
||
168 | } |
||
169 | } |
||
170 | } |
||
171 | #endif |
||
172 | |||
173 | |||
174 | #ifdef DEST_1UI |
||
175 | static void DEST_1UI( GLuint *t, |
||
176 | CONST void *ptr, |
||
177 | GLuint stride, |
||
178 | ARGS ) |
||
179 | { |
||
180 | const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
||
181 | const GLubyte *first = f; |
||
182 | GLuint i; |
||
183 | (void) start; |
||
184 | (void) first; |
||
185 | |||
186 | for (i = DST_START ; i < n ; i++, NEXT_F) { |
||
187 | CHECK { |
||
188 | NEXT_F2; |
||
189 | t[i] = TRX_UI(f, 0); |
||
190 | } |
||
191 | } |
||
192 | } |
||
193 | #endif |
||
194 | |||
195 | |||
196 | static void INIT(void) |
||
197 | { |
||
198 | #ifdef DEST_1UI |
||
199 | ASSERT(SZ == 1); |
||
200 | TAB(_1ui)[SRC_IDX] = DEST_1UI; |
||
201 | #endif |
||
202 | #ifdef DEST_1UB |
||
203 | ASSERT(SZ == 1); |
||
204 | TAB(_1ub)[SRC_IDX] = DEST_1UB; |
||
205 | #endif |
||
206 | #ifdef DEST_1F |
||
207 | ASSERT(SZ == 1); |
||
208 | TAB(_1f)[SRC_IDX] = DEST_1F; |
||
209 | #endif |
||
210 | #ifdef DEST_3F |
||
211 | ASSERT(SZ == 3); |
||
212 | TAB(_3f)[SRC_IDX] = DEST_3F; |
||
213 | #endif |
||
214 | #ifdef DEST_4UB |
||
215 | TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB; |
||
216 | #endif |
||
217 | #ifdef DEST_4US |
||
218 | TAB(_4us)[SZ][SRC_IDX] = DEST_4US; |
||
219 | #endif |
||
220 | #ifdef DEST_4F |
||
221 | TAB(_4f)[SZ][SRC_IDX] = DEST_4F; |
||
222 | #endif |
||
223 | |||
224 | } |
||
225 | |||
226 | |||
227 | #undef INIT |
||
228 | #undef DEST_1UI |
||
229 | #undef DEST_1UB |
||
230 | #undef DEST_4UB |
||
231 | #undef DEST_4US |
||
232 | #undef DEST_3F |
||
233 | #undef DEST_4F |
||
234 | #undef DEST_1F |
||
235 | #undef SZ |
||
236 | #undef TAG |