Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
/*
2
 * Mesa 3-D graphics library
3
 *
4
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
 * Software is furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included
14
 * in all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
 * OTHER DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
/**
26
 * \brief  Templates for vector conversions.
27
 * \author Keith Whitwell.
28
 */
29
 
30
#ifdef DEST_4F
31
static void DEST_4F( GLfloat (*t)[4],
32
		     const void *ptr,
33
		     GLuint stride,
34
		     ARGS )
35
{
36
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
37
   const GLubyte *first = f;
38
   GLuint i;
39
 
40
   (void) first;
41
   (void) start;
42
   for (i = DST_START ; i < n ; i++, NEXT_F) {
43
      CHECK {
44
         NEXT_F2;
45
	 if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
46
	 if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
47
	 if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
48
	 if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
49
      }
50
   }
51
}
52
#endif
53
 
54
 
55
 
56
#ifdef DEST_4FN
57
static void DEST_4FN( GLfloat (*t)[4],
58
		      const void *ptr,
59
		      GLuint stride,
60
		      ARGS )
61
{
62
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
63
   const GLubyte *first = f;
64
   GLuint i;
65
 
66
   (void) first;
67
   (void) start;
68
   for (i = DST_START ; i < n ; i++, NEXT_F) {
69
      CHECK {
70
         NEXT_F2;
71
	 if (SZ >= 1) t[i][0] = TRX_4FN(f, 0);
72
	 if (SZ >= 2) t[i][1] = TRX_4FN(f, 1);
73
	 if (SZ >= 3) t[i][2] = TRX_4FN(f, 2);
74
	 if (SZ == 4) t[i][3] = TRX_4FN(f, 3); else t[i][3] = 1.0;
75
      }
76
   }
77
}
78
#endif
79
 
80
 
81
#ifdef DEST_3FN
82
static void DEST_3FN( GLfloat (*t)[3],
83
		     const void *ptr,
84
		     GLuint stride,
85
		     ARGS )
86
{
87
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
88
   const GLubyte *first = f;
89
   GLuint i;
90
   (void) first;
91
   (void) start;
92
   for (i = DST_START ; i < n ; i++, NEXT_F) {
93
      CHECK {
94
         NEXT_F2;
95
	 t[i][0] = TRX_3FN(f, 0);
96
	 t[i][1] = TRX_3FN(f, 1);
97
	 t[i][2] = TRX_3FN(f, 2);
98
      }
99
   }
100
}
101
#endif
102
 
103
#ifdef DEST_1F
104
static void DEST_1F( GLfloat *t,
105
		     const void *ptr,
106
		     GLuint stride,
107
		     ARGS )
108
{
109
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
110
   const GLubyte *first = f;
111
   GLuint i;
112
   (void) first;
113
   (void) start;
114
   for (i = DST_START ; i < n ; i++, NEXT_F) {
115
      CHECK {
116
         NEXT_F2;
117
	 t[i] = TRX_1F(f, 0);
118
      }
119
   }
120
}
121
#endif
122
 
123
#ifdef DEST_4UB
124
static void DEST_4UB( GLubyte (*t)[4],
125
                      const void *ptr,
126
                      GLuint stride,
127
                      ARGS )
128
{
129
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
130
   const GLubyte *first = f;
131
   GLuint i;
132
   (void) start;
133
   (void) first;
134
   for (i = DST_START ; i < n ; i++, NEXT_F) {
135
      CHECK {
136
         NEXT_F2;
137
	 if (SZ >= 1) TRX_UB(t[i][0], f, 0);
138
	 if (SZ >= 2) TRX_UB(t[i][1], f, 1);
139
	 if (SZ >= 3) TRX_UB(t[i][2], f, 2);
140
	 if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
141
      }
142
   }
143
}
144
#endif
145
 
146
 
147
#ifdef DEST_4US
148
static void DEST_4US( GLushort (*t)[4],
149
                      const void *ptr,
150
                      GLuint stride,
151
                      ARGS )
152
{
153
   const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride);
154
   const GLubyte *first = f;
155
   GLuint i;
156
   (void) start;
157
   (void) first;
158
   for (i = DST_START ; i < n ; i++, NEXT_F) {
159
      CHECK {
160
         NEXT_F2;
161
	 if (SZ >= 1) TRX_US(t[i][0], f, 0);
162
	 if (SZ >= 2) TRX_US(t[i][1], f, 1);
163
	 if (SZ >= 3) TRX_US(t[i][2], f, 2);
164
	 if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
165
      }
166
   }
167
}
168
#endif
169
 
170
 
171
#ifdef DEST_1UB
172
static void DEST_1UB( GLubyte *t,
173
		      const void *ptr,
174
		      GLuint stride,
175
		      ARGS )
176
{
177
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
178
   const GLubyte *first = f;
179
   GLuint i;
180
   (void) start;
181
   (void) first;
182
   for (i = DST_START ; i < n ; i++, NEXT_F) {
183
      CHECK {
184
         NEXT_F2;
185
	  TRX_UB(t[i], f, 0);
186
      }
187
   }
188
}
189
#endif
190
 
191
 
192
#ifdef DEST_1UI
193
static void DEST_1UI( GLuint *t,
194
		      const void *ptr,
195
		      GLuint stride,
196
		      ARGS )
197
{
198
   const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
199
   const GLubyte *first = f;
200
   GLuint i;
201
   (void) start;
202
   (void) first;
203
 
204
   for (i = DST_START ; i < n ; i++, NEXT_F) {
205
      CHECK {
206
         NEXT_F2;
207
	 t[i] = TRX_UI(f, 0);
208
      }
209
   }
210
}
211
#endif
212
 
213
 
214
static void INIT(void)
215
{
216
#ifdef DEST_1UI
217
   ASSERT(SZ == 1);
218
   TAB(_1ui)[SRC_IDX] = DEST_1UI;
219
#endif
220
#ifdef DEST_1UB
221
   ASSERT(SZ == 1);
222
   TAB(_1ub)[SRC_IDX] = DEST_1UB;
223
#endif
224
#ifdef DEST_1F
225
   ASSERT(SZ == 1);
226
   TAB(_1f)[SRC_IDX] = DEST_1F;
227
#endif
228
#ifdef DEST_3FN
229
   ASSERT(SZ == 3);
230
   TAB(_3fn)[SRC_IDX] = DEST_3FN;
231
#endif
232
#ifdef DEST_4UB
233
   TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB;
234
#endif
235
#ifdef DEST_4US
236
   TAB(_4us)[SZ][SRC_IDX] = DEST_4US;
237
#endif
238
#ifdef DEST_4F
239
   TAB(_4f)[SZ][SRC_IDX] = DEST_4F;
240
#endif
241
#ifdef DEST_4FN
242
   TAB(_4fn)[SZ][SRC_IDX] = DEST_4FN;
243
#endif
244
 
245
}
246
 
247
 
248
#ifdef INIT
249
#undef INIT
250
#endif
251
#ifdef DEST_1UI
252
#undef DEST_1UI
253
#endif
254
#ifdef DEST_1UB
255
#undef DEST_1UB
256
#endif
257
#ifdef DEST_4UB
258
#undef DEST_4UB
259
#endif
260
#ifdef DEST_4US
261
#undef DEST_4US
262
#endif
263
#ifdef DEST_3FN
264
#undef DEST_3FN
265
#endif
266
#ifdef DEST_4F
267
#undef DEST_4F
268
#endif
269
#ifdef DEST_4FN
270
#undef DEST_4FN
271
#endif
272
#ifdef DEST_1F
273
#undef DEST_1F
274
#endif
275
#ifdef SZ
276
#undef SZ
277
#endif
278
#ifdef TAG
279
#undef TAG
280
#endif
281