2 * Mesa 3-D graphics library
4 * Copyright (c) 2011 VMware, Inc.
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:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
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.
27 #include "format_unpack.h"
29 #include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
30 #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
33 /** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */
41 /* Expand 1, 2, 3, 4, 5, 6-bit values to fill 8 bits */
43 #define EXPAND_1_8(X) ( (X) ? 0xff : 0x0 )
45 #define EXPAND_2_8(X) ( ((X) << 6) | ((X) << 4) | ((X) << 2) | (X) )
47 #define EXPAND_3_8(X) ( ((X) << 5) | ((X) << 2) | ((X) >> 1) )
49 #define EXPAND_4_8(X) ( ((X) << 4) | (X) )
51 #define EXPAND_5_8(X) ( ((X) << 3) | ((X) >> 2) )
53 #define EXPAND_6_8(X) ( ((X) << 2) | ((X) >> 4) )
57 * Convert an 8-bit sRGB value from non-linear space to a
58 * linear RGB value in [0, 1].
59 * Implemented with a 256-entry lookup table.
62 _mesa_nonlinear_to_linear(GLubyte cs8
)
64 static GLfloat table
[256];
65 static GLboolean tableReady
= GL_FALSE
;
67 /* compute lookup table now */
69 for (i
= 0; i
< 256; i
++) {
70 const GLfloat cs
= UBYTE_TO_FLOAT(i
);
72 table
[i
] = cs
/ 12.92f
;
75 table
[i
] = (GLfloat
) pow((cs
+ 0.055) / 1.055, 2.4);
84 /**********************************************************************/
85 /* Unpack, returning GLfloat colors */
86 /**********************************************************************/
88 typedef void (*unpack_rgba_func
)(const void *src
, GLfloat dst
[][4], GLuint n
);
92 unpack_RGBA8888(const void *src
, GLfloat dst
[][4], GLuint n
)
94 const GLuint
*s
= ((const GLuint
*) src
);
96 for (i
= 0; i
< n
; i
++) {
97 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
98 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
99 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
100 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
105 unpack_RGBA8888_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
107 const GLuint
*s
= ((const GLuint
*) src
);
109 for (i
= 0; i
< n
; i
++) {
110 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
111 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
112 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
113 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
118 unpack_ARGB8888(const void *src
, GLfloat dst
[][4], GLuint n
)
120 const GLuint
*s
= ((const GLuint
*) src
);
122 for (i
= 0; i
< n
; i
++) {
123 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
124 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
125 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
126 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
131 unpack_ARGB8888_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
133 const GLuint
*s
= ((const GLuint
*) src
);
135 for (i
= 0; i
< n
; i
++) {
136 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
137 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
138 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
139 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
144 unpack_RGBX8888(const void *src
, GLfloat dst
[][4], GLuint n
)
146 const GLuint
*s
= ((const GLuint
*) src
);
148 for (i
= 0; i
< n
; i
++) {
149 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
150 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
151 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
152 dst
[i
][ACOMP
] = 1.0f
;
157 unpack_RGBX8888_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
159 const GLuint
*s
= ((const GLuint
*) src
);
161 for (i
= 0; i
< n
; i
++) {
162 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
163 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
164 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
165 dst
[i
][ACOMP
] = 1.0f
;
170 unpack_XRGB8888(const void *src
, GLfloat dst
[][4], GLuint n
)
172 const GLuint
*s
= ((const GLuint
*) src
);
174 for (i
= 0; i
< n
; i
++) {
175 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
176 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
177 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] ) & 0xff );
178 dst
[i
][ACOMP
] = 1.0f
;
183 unpack_XRGB8888_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
185 const GLuint
*s
= ((const GLuint
*) src
);
187 for (i
= 0; i
< n
; i
++) {
188 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 8) & 0xff );
189 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 16) & 0xff );
190 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( (s
[i
] >> 24) );
191 dst
[i
][ACOMP
] = 1.0f
;
196 unpack_RGB888(const void *src
, GLfloat dst
[][4], GLuint n
)
198 const GLubyte
*s
= (const GLubyte
*) src
;
200 for (i
= 0; i
< n
; i
++) {
201 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+2] );
202 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+1] );
203 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+0] );
204 dst
[i
][ACOMP
] = 1.0F
;
209 unpack_BGR888(const void *src
, GLfloat dst
[][4], GLuint n
)
211 const GLubyte
*s
= (const GLubyte
*) src
;
213 for (i
= 0; i
< n
; i
++) {
214 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+0] );
215 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+1] );
216 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( s
[i
*3+2] );
217 dst
[i
][ACOMP
] = 1.0F
;
222 unpack_RGB565(const void *src
, GLfloat dst
[][4], GLuint n
)
224 const GLushort
*s
= ((const GLushort
*) src
);
226 for (i
= 0; i
< n
; i
++) {
227 dst
[i
][RCOMP
] = ((s
[i
] >> 11) & 0x1f) * (1.0F
/ 31.0F
);
228 dst
[i
][GCOMP
] = ((s
[i
] >> 5 ) & 0x3f) * (1.0F
/ 63.0F
);
229 dst
[i
][BCOMP
] = ((s
[i
] ) & 0x1f) * (1.0F
/ 31.0F
);
230 dst
[i
][ACOMP
] = 1.0F
;
235 unpack_RGB565_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
237 const GLushort
*s
= ((const GLushort
*) src
);
239 for (i
= 0; i
< n
; i
++) {
240 GLuint t
= (s
[i
] >> 8) | (s
[i
] << 8); /* byte swap */
241 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( ((t
>> 8) & 0xf8) | ((t
>> 13) & 0x7) );
242 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( ((t
>> 3) & 0xfc) | ((t
>> 9) & 0x3) );
243 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( ((t
<< 3) & 0xf8) | ((t
>> 2) & 0x7) );
244 dst
[i
][ACOMP
] = 1.0F
;
249 unpack_ARGB4444(const void *src
, GLfloat dst
[][4], GLuint n
)
251 const GLushort
*s
= ((const GLushort
*) src
);
253 for (i
= 0; i
< n
; i
++) {
254 dst
[i
][RCOMP
] = ((s
[i
] >> 8) & 0xf) * (1.0F
/ 15.0F
);
255 dst
[i
][GCOMP
] = ((s
[i
] >> 4) & 0xf) * (1.0F
/ 15.0F
);
256 dst
[i
][BCOMP
] = ((s
[i
] ) & 0xf) * (1.0F
/ 15.0F
);
257 dst
[i
][ACOMP
] = ((s
[i
] >> 12) & 0xf) * (1.0F
/ 15.0F
);
262 unpack_ARGB4444_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
264 const GLushort
*s
= ((const GLushort
*) src
);
266 for (i
= 0; i
< n
; i
++) {
267 dst
[i
][RCOMP
] = ((s
[i
] ) & 0xf) * (1.0F
/ 15.0F
);
268 dst
[i
][GCOMP
] = ((s
[i
] >> 12) & 0xf) * (1.0F
/ 15.0F
);
269 dst
[i
][BCOMP
] = ((s
[i
] >> 8) & 0xf) * (1.0F
/ 15.0F
);
270 dst
[i
][ACOMP
] = ((s
[i
] >> 4) & 0xf) * (1.0F
/ 15.0F
);
275 unpack_RGBA5551(const void *src
, GLfloat dst
[][4], GLuint n
)
277 const GLushort
*s
= ((const GLushort
*) src
);
279 for (i
= 0; i
< n
; i
++) {
280 dst
[i
][RCOMP
] = ((s
[i
] >> 11) & 0x1f) * (1.0F
/ 31.0F
);
281 dst
[i
][GCOMP
] = ((s
[i
] >> 6) & 0x1f) * (1.0F
/ 31.0F
);
282 dst
[i
][BCOMP
] = ((s
[i
] >> 1) & 0x1f) * (1.0F
/ 31.0F
);
283 dst
[i
][ACOMP
] = ((s
[i
] ) & 0x01) * 1.0F
;
288 unpack_ARGB1555(const void *src
, GLfloat dst
[][4], GLuint n
)
290 const GLushort
*s
= ((const GLushort
*) src
);
292 for (i
= 0; i
< n
; i
++) {
293 dst
[i
][RCOMP
] = ((s
[i
] >> 10) & 0x1f) * (1.0F
/ 31.0F
);
294 dst
[i
][GCOMP
] = ((s
[i
] >> 5) & 0x1f) * (1.0F
/ 31.0F
);
295 dst
[i
][BCOMP
] = ((s
[i
] >> 0) & 0x1f) * (1.0F
/ 31.0F
);
296 dst
[i
][ACOMP
] = ((s
[i
] >> 15) & 0x01) * 1.0F
;
301 unpack_ARGB1555_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
303 const GLushort
*s
= ((const GLushort
*) src
);
305 for (i
= 0; i
< n
; i
++) {
306 GLushort tmp
= (s
[i
] << 8) | (s
[i
] >> 8); /* byteswap */
307 dst
[i
][RCOMP
] = ((tmp
>> 10) & 0x1f) * (1.0F
/ 31.0F
);
308 dst
[i
][GCOMP
] = ((tmp
>> 5) & 0x1f) * (1.0F
/ 31.0F
);
309 dst
[i
][BCOMP
] = ((tmp
>> 0) & 0x1f) * (1.0F
/ 31.0F
);
310 dst
[i
][ACOMP
] = ((tmp
>> 15) & 0x01) * 1.0F
;
315 unpack_AL44(const void *src
, GLfloat dst
[][4], GLuint n
)
317 const GLubyte
*s
= ((const GLubyte
*) src
);
319 for (i
= 0; i
< n
; i
++) {
322 dst
[i
][BCOMP
] = (s
[i
] & 0xf) * (1.0F
/ 15.0F
);
323 dst
[i
][ACOMP
] = ((s
[i
] >> 4) & 0xf) * (1.0F
/ 15.0F
);
328 unpack_AL88(const void *src
, GLfloat dst
[][4], GLuint n
)
330 const GLushort
*s
= ((const GLushort
*) src
);
332 for (i
= 0; i
< n
; i
++) {
335 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( s
[i
] & 0xff );
336 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 8 );
341 unpack_AL88_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
343 const GLushort
*s
= ((const GLushort
*) src
);
345 for (i
= 0; i
< n
; i
++) {
348 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 8 );
349 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( s
[i
] & 0xff );
354 unpack_AL1616(const void *src
, GLfloat dst
[][4], GLuint n
)
356 const GLuint
*s
= ((const GLuint
*) src
);
358 for (i
= 0; i
< n
; i
++) {
361 dst
[i
][BCOMP
] = USHORT_TO_FLOAT( s
[i
] & 0xffff );
362 dst
[i
][ACOMP
] = USHORT_TO_FLOAT( s
[i
] >> 16 );
367 unpack_AL1616_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
369 const GLuint
*s
= ((const GLuint
*) src
);
371 for (i
= 0; i
< n
; i
++) {
374 dst
[i
][BCOMP
] = USHORT_TO_FLOAT( s
[i
] >> 16 );
375 dst
[i
][ACOMP
] = USHORT_TO_FLOAT( s
[i
] & 0xffff );
380 unpack_RGB332(const void *src
, GLfloat dst
[][4], GLuint n
)
382 const GLubyte
*s
= ((const GLubyte
*) src
);
384 for (i
= 0; i
< n
; i
++) {
385 dst
[i
][RCOMP
] = ((s
[i
] >> 5) & 0x7) * (1.0F
/ 7.0F
);
386 dst
[i
][GCOMP
] = ((s
[i
] >> 2) & 0x7) * (1.0F
/ 7.0F
);
387 dst
[i
][BCOMP
] = ((s
[i
] ) & 0x3) * (1.0F
/ 3.0F
);
388 dst
[i
][ACOMP
] = 1.0F
;
394 unpack_A8(const void *src
, GLfloat dst
[][4], GLuint n
)
396 const GLubyte
*s
= ((const GLubyte
*) src
);
398 for (i
= 0; i
< n
; i
++) {
401 dst
[i
][BCOMP
] = 0.0F
;
402 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT(s
[i
]);
407 unpack_A16(const void *src
, GLfloat dst
[][4], GLuint n
)
409 const GLushort
*s
= ((const GLushort
*) src
);
411 for (i
= 0; i
< n
; i
++) {
414 dst
[i
][BCOMP
] = 0.0F
;
415 dst
[i
][ACOMP
] = USHORT_TO_FLOAT(s
[i
]);
420 unpack_L8(const void *src
, GLfloat dst
[][4], GLuint n
)
422 const GLubyte
*s
= ((const GLubyte
*) src
);
424 for (i
= 0; i
< n
; i
++) {
427 dst
[i
][BCOMP
] = UBYTE_TO_FLOAT(s
[i
]);
428 dst
[i
][ACOMP
] = 1.0F
;
433 unpack_L16(const void *src
, GLfloat dst
[][4], GLuint n
)
435 const GLushort
*s
= ((const GLushort
*) src
);
437 for (i
= 0; i
< n
; i
++) {
440 dst
[i
][BCOMP
] = USHORT_TO_FLOAT(s
[i
]);
441 dst
[i
][ACOMP
] = 1.0F
;
446 unpack_I8(const void *src
, GLfloat dst
[][4], GLuint n
)
448 const GLubyte
*s
= ((const GLubyte
*) src
);
450 for (i
= 0; i
< n
; i
++) {
454 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT(s
[i
]);
459 unpack_I16(const void *src
, GLfloat dst
[][4], GLuint n
)
461 const GLushort
*s
= ((const GLushort
*) src
);
463 for (i
= 0; i
< n
; i
++) {
467 dst
[i
][ACOMP
] = USHORT_TO_FLOAT(s
[i
]);
472 unpack_YCBCR(const void *src
, GLfloat dst
[][4], GLuint n
)
475 for (i
= 0; i
< n
; i
++) {
476 const GLushort
*src0
= ((const GLushort
*) src
) + i
* 2; /* even */
477 const GLushort
*src1
= src0
+ 1; /* odd */
478 const GLubyte y0
= (*src0
>> 8) & 0xff; /* luminance */
479 const GLubyte cb
= *src0
& 0xff; /* chroma U */
480 const GLubyte y1
= (*src1
>> 8) & 0xff; /* luminance */
481 const GLubyte cr
= *src1
& 0xff; /* chroma V */
482 const GLubyte y
= (i
& 1) ? y1
: y0
; /* choose even/odd luminance */
483 GLfloat r
= 1.164F
* (y
- 16) + 1.596F
* (cr
- 128);
484 GLfloat g
= 1.164F
* (y
- 16) - 0.813F
* (cr
- 128) - 0.391F
* (cb
- 128);
485 GLfloat b
= 1.164F
* (y
- 16) + 2.018F
* (cb
- 128);
486 r
*= (1.0F
/ 255.0F
);
487 g
*= (1.0F
/ 255.0F
);
488 b
*= (1.0F
/ 255.0F
);
489 dst
[i
][RCOMP
] = CLAMP(r
, 0.0F
, 1.0F
);
490 dst
[i
][GCOMP
] = CLAMP(g
, 0.0F
, 1.0F
);
491 dst
[i
][BCOMP
] = CLAMP(b
, 0.0F
, 1.0F
);
492 dst
[i
][ACOMP
] = 1.0F
;
497 unpack_YCBCR_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
500 for (i
= 0; i
< n
; i
++) {
501 const GLushort
*src0
= ((const GLushort
*) src
) + i
* 2; /* even */
502 const GLushort
*src1
= src0
+ 1; /* odd */
503 const GLubyte y0
= *src0
& 0xff; /* luminance */
504 const GLubyte cr
= (*src0
>> 8) & 0xff; /* chroma V */
505 const GLubyte y1
= *src1
& 0xff; /* luminance */
506 const GLubyte cb
= (*src1
>> 8) & 0xff; /* chroma U */
507 const GLubyte y
= (i
& 1) ? y1
: y0
; /* choose even/odd luminance */
508 GLfloat r
= 1.164F
* (y
- 16) + 1.596F
* (cr
- 128);
509 GLfloat g
= 1.164F
* (y
- 16) - 0.813F
* (cr
- 128) - 0.391F
* (cb
- 128);
510 GLfloat b
= 1.164F
* (y
- 16) + 2.018F
* (cb
- 128);
511 r
*= (1.0F
/ 255.0F
);
512 g
*= (1.0F
/ 255.0F
);
513 b
*= (1.0F
/ 255.0F
);
514 dst
[i
][RCOMP
] = CLAMP(r
, 0.0F
, 1.0F
);
515 dst
[i
][GCOMP
] = CLAMP(g
, 0.0F
, 1.0F
);
516 dst
[i
][BCOMP
] = CLAMP(b
, 0.0F
, 1.0F
);
517 dst
[i
][ACOMP
] = 1.0F
;
522 unpack_R8(const void *src
, GLfloat dst
[][4], GLuint n
)
524 const GLubyte
*s
= ((const GLubyte
*) src
);
526 for (i
= 0; i
< n
; i
++) {
527 dst
[i
][0] = UBYTE_TO_FLOAT(s
[i
]);
535 unpack_GR88(const void *src
, GLfloat dst
[][4], GLuint n
)
537 const GLushort
*s
= ((const GLushort
*) src
);
539 for (i
= 0; i
< n
; i
++) {
540 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( s
[i
] & 0xff );
541 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 8 );
548 unpack_RG88(const void *src
, GLfloat dst
[][4], GLuint n
)
550 const GLushort
*s
= ((const GLushort
*) src
);
552 for (i
= 0; i
< n
; i
++) {
553 dst
[i
][RCOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 8 );
554 dst
[i
][GCOMP
] = UBYTE_TO_FLOAT( s
[i
] & 0xff );
561 unpack_R16(const void *src
, GLfloat dst
[][4], GLuint n
)
563 const GLushort
*s
= ((const GLushort
*) src
);
565 for (i
= 0; i
< n
; i
++) {
566 dst
[i
][RCOMP
] = USHORT_TO_FLOAT(s
[i
]);
574 unpack_GR1616(const void *src
, GLfloat dst
[][4], GLuint n
)
576 const GLuint
*s
= ((const GLuint
*) src
);
578 for (i
= 0; i
< n
; i
++) {
579 dst
[i
][RCOMP
] = USHORT_TO_FLOAT( s
[i
] & 0xffff );
580 dst
[i
][GCOMP
] = USHORT_TO_FLOAT( s
[i
] >> 16 );
587 unpack_RG1616(const void *src
, GLfloat dst
[][4], GLuint n
)
589 const GLuint
*s
= ((const GLuint
*) src
);
591 for (i
= 0; i
< n
; i
++) {
592 dst
[i
][RCOMP
] = USHORT_TO_FLOAT( s
[i
] >> 16 );
593 dst
[i
][GCOMP
] = USHORT_TO_FLOAT( s
[i
] & 0xffff );
600 unpack_ARGB2101010(const void *src
, GLfloat dst
[][4], GLuint n
)
602 const GLuint
*s
= ((const GLuint
*) src
);
604 for (i
= 0; i
< n
; i
++) {
605 dst
[i
][RCOMP
] = ((s
[i
] >> 20) & 0x3ff) * (1.0F
/ 1023.0F
);
606 dst
[i
][GCOMP
] = ((s
[i
] >> 10) & 0x3ff) * (1.0F
/ 1023.0F
);
607 dst
[i
][BCOMP
] = ((s
[i
] >> 0) & 0x3ff) * (1.0F
/ 1023.0F
);
608 dst
[i
][ACOMP
] = ((s
[i
] >> 30) & 0x03) * (1.0F
/ 3.0F
);
614 unpack_ARGB2101010_UINT(const void *src
, GLfloat dst
[][4], GLuint n
)
616 const GLuint
*s
= (const GLuint
*) src
;
618 for (i
= 0; i
< n
; i
++) {
619 dst
[i
][RCOMP
] = (GLfloat
)((s
[i
] >> 20) & 0x3ff);
620 dst
[i
][GCOMP
] = (GLfloat
)((s
[i
] >> 10) & 0x3ff);
621 dst
[i
][BCOMP
] = (GLfloat
)((s
[i
] >> 0) & 0x3ff);
622 dst
[i
][ACOMP
] = (GLfloat
)((s
[i
] >> 30) & 0x03);
628 unpack_ABGR2101010_UINT(const void *src
, GLfloat dst
[][4], GLuint n
)
630 const GLuint
*s
= ((const GLuint
*) src
);
632 for (i
= 0; i
< n
; i
++) {
633 dst
[i
][RCOMP
] = (GLfloat
)((s
[i
] >> 0) & 0x3ff);
634 dst
[i
][GCOMP
] = (GLfloat
)((s
[i
] >> 10) & 0x3ff);
635 dst
[i
][BCOMP
] = (GLfloat
)((s
[i
] >> 20) & 0x3ff);
636 dst
[i
][ACOMP
] = (GLfloat
)((s
[i
] >> 30) & 0x03);
642 unpack_Z24_S8(const void *src
, GLfloat dst
[][4], GLuint n
)
644 /* only return Z, not stencil data */
645 const GLuint
*s
= ((const GLuint
*) src
);
646 const GLdouble scale
= 1.0 / (GLdouble
) 0xffffff;
648 for (i
= 0; i
< n
; i
++) {
651 dst
[i
][2] = (GLfloat
) ((s
[i
] >> 8) * scale
);
653 ASSERT(dst
[i
][0] >= 0.0F
);
654 ASSERT(dst
[i
][0] <= 1.0F
);
659 unpack_S8_Z24(const void *src
, GLfloat dst
[][4], GLuint n
)
661 /* only return Z, not stencil data */
662 const GLuint
*s
= ((const GLuint
*) src
);
663 const GLdouble scale
= 1.0 / (GLdouble
) 0xffffff;
665 for (i
= 0; i
< n
; i
++) {
668 dst
[i
][2] = (float) ((s
[i
] & 0x00ffffff) * scale
);
670 ASSERT(dst
[i
][0] >= 0.0F
);
671 ASSERT(dst
[i
][0] <= 1.0F
);
676 unpack_Z16(const void *src
, GLfloat dst
[][4], GLuint n
)
678 const GLushort
*s
= ((const GLushort
*) src
);
680 for (i
= 0; i
< n
; i
++) {
683 dst
[i
][2] = s
[i
] * (1.0F
/ 65535.0F
);
689 unpack_X8_Z24(const void *src
, GLfloat dst
[][4], GLuint n
)
691 unpack_S8_Z24(src
, dst
, n
);
695 unpack_Z24_X8(const void *src
, GLfloat dst
[][4], GLuint n
)
697 unpack_Z24_S8(src
, dst
, n
);
701 unpack_Z32(const void *src
, GLfloat dst
[][4], GLuint n
)
703 const GLuint
*s
= ((const GLuint
*) src
);
705 for (i
= 0; i
< n
; i
++) {
708 dst
[i
][2] = s
[i
] * (1.0F
/ 0xffffffff);
714 unpack_Z32_FLOAT(const void *src
, GLfloat dst
[][4], GLuint n
)
716 const GLfloat
*s
= ((const GLfloat
*) src
);
718 for (i
= 0; i
< n
; i
++) {
721 dst
[i
][2] = s
[i
* 2];
727 unpack_Z32_FLOAT_X24S8(const void *src
, GLfloat dst
[][4], GLuint n
)
729 const GLfloat
*s
= ((const GLfloat
*) src
);
731 for (i
= 0; i
< n
; i
++) {
741 unpack_S8(const void *src
, GLfloat dst
[][4], GLuint n
)
743 /* should never be used */
745 for (i
= 0; i
< n
; i
++) {
755 unpack_SRGB8(const void *src
, GLfloat dst
[][4], GLuint n
)
757 const GLubyte
*s
= (const GLubyte
*) src
;
759 for (i
= 0; i
< n
; i
++) {
760 dst
[i
][RCOMP
] = _mesa_nonlinear_to_linear(s
[i
*3+2]);
761 dst
[i
][GCOMP
] = _mesa_nonlinear_to_linear(s
[i
*3+1]);
762 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear(s
[i
*3+0]);
763 dst
[i
][ACOMP
] = 1.0F
;
768 unpack_SRGBA8(const void *src
, GLfloat dst
[][4], GLuint n
)
770 const GLuint
*s
= ((const GLuint
*) src
);
772 for (i
= 0; i
< n
; i
++) {
773 dst
[i
][RCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 24) );
774 dst
[i
][GCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 16) & 0xff );
775 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 8) & 0xff );
776 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( s
[i
] & 0xff ); /* linear! */
781 unpack_SARGB8(const void *src
, GLfloat dst
[][4], GLuint n
)
783 const GLuint
*s
= ((const GLuint
*) src
);
785 for (i
= 0; i
< n
; i
++) {
786 dst
[i
][RCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 16) & 0xff );
787 dst
[i
][GCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 8) & 0xff );
788 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] ) & 0xff );
789 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 24 ); /* linear! */
794 unpack_SL8(const void *src
, GLfloat dst
[][4], GLuint n
)
796 const GLubyte
*s
= ((const GLubyte
*) src
);
798 for (i
= 0; i
< n
; i
++) {
801 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear(s
[i
]);
802 dst
[i
][ACOMP
] = 1.0F
;
807 unpack_SLA8(const void *src
, GLfloat dst
[][4], GLuint n
)
809 const GLushort
*s
= (const GLushort
*) src
;
811 for (i
= 0; i
< n
; i
++) {
814 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear(s
[i
] & 0xff);
815 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT(s
[i
] >> 8); /* linear! */
820 unpack_SRGB_DXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
825 unpack_SRGBA_DXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
830 unpack_SRGBA_DXT3(const void *src
, GLfloat dst
[][4], GLuint n
)
835 unpack_SRGBA_DXT5(const void *src
, GLfloat dst
[][4], GLuint n
)
840 unpack_RGB_FXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
845 unpack_RGBA_FXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
850 unpack_RGB_DXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
855 unpack_RGBA_DXT1(const void *src
, GLfloat dst
[][4], GLuint n
)
860 unpack_RGBA_DXT3(const void *src
, GLfloat dst
[][4], GLuint n
)
865 unpack_RGBA_DXT5(const void *src
, GLfloat dst
[][4], GLuint n
)
871 unpack_RGBA_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
873 const GLfloat
*s
= (const GLfloat
*) src
;
875 for (i
= 0; i
< n
; i
++) {
876 dst
[i
][RCOMP
] = s
[i
*4+0];
877 dst
[i
][GCOMP
] = s
[i
*4+1];
878 dst
[i
][BCOMP
] = s
[i
*4+2];
879 dst
[i
][ACOMP
] = s
[i
*4+3];
884 unpack_RGBA_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
886 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
888 for (i
= 0; i
< n
; i
++) {
889 dst
[i
][RCOMP
] = _mesa_half_to_float(s
[i
*4+0]);
890 dst
[i
][GCOMP
] = _mesa_half_to_float(s
[i
*4+1]);
891 dst
[i
][BCOMP
] = _mesa_half_to_float(s
[i
*4+2]);
892 dst
[i
][ACOMP
] = _mesa_half_to_float(s
[i
*4+3]);
897 unpack_RGB_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
899 const GLfloat
*s
= (const GLfloat
*) src
;
901 for (i
= 0; i
< n
; i
++) {
902 dst
[i
][RCOMP
] = s
[i
*3+0];
903 dst
[i
][GCOMP
] = s
[i
*3+1];
904 dst
[i
][BCOMP
] = s
[i
*3+2];
905 dst
[i
][ACOMP
] = 1.0F
;
910 unpack_RGB_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
912 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
914 for (i
= 0; i
< n
; i
++) {
915 dst
[i
][RCOMP
] = _mesa_half_to_float(s
[i
*3+0]);
916 dst
[i
][GCOMP
] = _mesa_half_to_float(s
[i
*3+1]);
917 dst
[i
][BCOMP
] = _mesa_half_to_float(s
[i
*3+2]);
918 dst
[i
][ACOMP
] = 1.0F
;
923 unpack_ALPHA_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
925 const GLfloat
*s
= (const GLfloat
*) src
;
927 for (i
= 0; i
< n
; i
++) {
930 dst
[i
][BCOMP
] = 0.0F
;
931 dst
[i
][ACOMP
] = s
[i
];
936 unpack_ALPHA_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
938 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
940 for (i
= 0; i
< n
; i
++) {
943 dst
[i
][BCOMP
] = 0.0F
;
944 dst
[i
][ACOMP
] = _mesa_half_to_float(s
[i
]);
949 unpack_LUMINANCE_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
951 const GLfloat
*s
= (const GLfloat
*) src
;
953 for (i
= 0; i
< n
; i
++) {
956 dst
[i
][BCOMP
] = s
[i
];
957 dst
[i
][ACOMP
] = 1.0F
;
962 unpack_LUMINANCE_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
964 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
966 for (i
= 0; i
< n
; i
++) {
969 dst
[i
][BCOMP
] = _mesa_half_to_float(s
[i
]);
970 dst
[i
][ACOMP
] = 1.0F
;
975 unpack_LUMINANCE_ALPHA_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
977 const GLfloat
*s
= (const GLfloat
*) src
;
979 for (i
= 0; i
< n
; i
++) {
982 dst
[i
][BCOMP
] = s
[i
*2+0];
983 dst
[i
][ACOMP
] = s
[i
*2+1];
988 unpack_LUMINANCE_ALPHA_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
990 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
992 for (i
= 0; i
< n
; i
++) {
995 dst
[i
][BCOMP
] = _mesa_half_to_float(s
[i
*2+0]);
996 dst
[i
][ACOMP
] = _mesa_half_to_float(s
[i
*2+1]);
1001 unpack_INTENSITY_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1003 const GLfloat
*s
= (const GLfloat
*) src
;
1005 for (i
= 0; i
< n
; i
++) {
1009 dst
[i
][ACOMP
] = s
[i
];
1014 unpack_INTENSITY_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1016 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
1018 for (i
= 0; i
< n
; i
++) {
1022 dst
[i
][ACOMP
] = _mesa_half_to_float(s
[i
]);
1027 unpack_R_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1029 const GLfloat
*s
= (const GLfloat
*) src
;
1031 for (i
= 0; i
< n
; i
++) {
1032 dst
[i
][RCOMP
] = s
[i
];
1033 dst
[i
][GCOMP
] = 0.0F
;
1034 dst
[i
][BCOMP
] = 0.0F
;
1035 dst
[i
][ACOMP
] = 1.0F
;
1040 unpack_R_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1042 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
1044 for (i
= 0; i
< n
; i
++) {
1045 dst
[i
][RCOMP
] = _mesa_half_to_float(s
[i
]);
1046 dst
[i
][GCOMP
] = 0.0F
;
1047 dst
[i
][BCOMP
] = 0.0F
;
1048 dst
[i
][ACOMP
] = 1.0F
;
1053 unpack_RG_FLOAT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1055 const GLfloat
*s
= (const GLfloat
*) src
;
1057 for (i
= 0; i
< n
; i
++) {
1058 dst
[i
][RCOMP
] = s
[i
*2+0];
1059 dst
[i
][GCOMP
] = s
[i
*2+1];
1060 dst
[i
][BCOMP
] = 0.0F
;
1061 dst
[i
][ACOMP
] = 1.0F
;
1066 unpack_RG_FLOAT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1068 const GLhalfARB
*s
= (const GLhalfARB
*) src
;
1070 for (i
= 0; i
< n
; i
++) {
1071 dst
[i
][RCOMP
] = _mesa_half_to_float(s
[i
*2+0]);
1072 dst
[i
][GCOMP
] = _mesa_half_to_float(s
[i
*2+1]);
1073 dst
[i
][BCOMP
] = 0.0F
;
1074 dst
[i
][ACOMP
] = 1.0F
;
1080 unpack_R_INT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1082 const GLbyte
*s
= (const GLbyte
*) src
;
1084 for (i
= 0; i
< n
; i
++) {
1085 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1086 dst
[i
][GCOMP
] = 0.0;
1087 dst
[i
][BCOMP
] = 0.0;
1088 dst
[i
][ACOMP
] = 1.0;
1093 unpack_RG_INT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1095 const GLbyte
*s
= (const GLbyte
*) src
;
1097 for (i
= 0; i
< n
; i
++) {
1098 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1099 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1100 dst
[i
][BCOMP
] = 0.0;
1101 dst
[i
][ACOMP
] = 1.0;
1106 unpack_RGB_INT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1108 const GLbyte
*s
= (const GLbyte
*) src
;
1110 for (i
= 0; i
< n
; i
++) {
1111 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1112 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1113 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1114 dst
[i
][ACOMP
] = 1.0;
1119 unpack_RGBA_INT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1121 const GLbyte
*s
= (const GLbyte
*) src
;
1123 for (i
= 0; i
< n
; i
++) {
1124 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1125 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1126 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1127 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1132 unpack_R_INT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1134 const GLshort
*s
= (const GLshort
*) src
;
1136 for (i
= 0; i
< n
; i
++) {
1137 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1138 dst
[i
][GCOMP
] = 0.0;
1139 dst
[i
][BCOMP
] = 0.0;
1140 dst
[i
][ACOMP
] = 1.0;
1145 unpack_RG_INT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1147 const GLshort
*s
= (const GLshort
*) src
;
1149 for (i
= 0; i
< n
; i
++) {
1150 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1151 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1152 dst
[i
][BCOMP
] = 0.0;
1153 dst
[i
][ACOMP
] = 1.0;
1158 unpack_RGB_INT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1160 const GLshort
*s
= (const GLshort
*) src
;
1162 for (i
= 0; i
< n
; i
++) {
1163 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1164 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1165 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1166 dst
[i
][ACOMP
] = 1.0;
1171 unpack_RGBA_INT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1173 const GLshort
*s
= (const GLshort
*) src
;
1175 for (i
= 0; i
< n
; i
++) {
1176 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1177 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1178 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1179 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1184 unpack_R_INT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1186 const GLint
*s
= (const GLint
*) src
;
1188 for (i
= 0; i
< n
; i
++) {
1189 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1190 dst
[i
][GCOMP
] = 0.0;
1191 dst
[i
][BCOMP
] = 0.0;
1192 dst
[i
][ACOMP
] = 1.0;
1197 unpack_RG_INT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1199 const GLint
*s
= (const GLint
*) src
;
1201 for (i
= 0; i
< n
; i
++) {
1202 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1203 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1204 dst
[i
][BCOMP
] = 0.0;
1205 dst
[i
][ACOMP
] = 1.0;
1210 unpack_RGB_INT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1212 const GLint
*s
= (const GLint
*) src
;
1214 for (i
= 0; i
< n
; i
++) {
1215 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1216 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1217 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1218 dst
[i
][ACOMP
] = 1.0;
1224 unpack_RGBA_INT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1226 const GLint
*s
= (const GLint
*) src
;
1228 for (i
= 0; i
< n
; i
++) {
1229 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1230 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1231 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1232 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1237 unpack_R_UINT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1239 const GLubyte
*s
= (const GLubyte
*) src
;
1241 for (i
= 0; i
< n
; i
++) {
1242 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1243 dst
[i
][GCOMP
] = 0.0;
1244 dst
[i
][BCOMP
] = 0.0;
1245 dst
[i
][ACOMP
] = 1.0;
1250 unpack_RG_UINT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1252 const GLubyte
*s
= (const GLubyte
*) src
;
1254 for (i
= 0; i
< n
; i
++) {
1255 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1256 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1257 dst
[i
][BCOMP
] = 0.0;
1258 dst
[i
][ACOMP
] = 1.0;
1263 unpack_RGB_UINT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1265 const GLubyte
*s
= (const GLubyte
*) src
;
1267 for (i
= 0; i
< n
; i
++) {
1268 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1269 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1270 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1271 dst
[i
][ACOMP
] = 1.0;
1276 unpack_RGBA_UINT8(const void *src
, GLfloat dst
[][4], GLuint n
)
1278 const GLubyte
*s
= (const GLubyte
*) src
;
1280 for (i
= 0; i
< n
; i
++) {
1281 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1282 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1283 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1284 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1289 unpack_R_UINT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1291 const GLushort
*s
= (const GLushort
*) src
;
1293 for (i
= 0; i
< n
; i
++) {
1294 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1295 dst
[i
][GCOMP
] = 0.0;
1296 dst
[i
][BCOMP
] = 0.0;
1297 dst
[i
][ACOMP
] = 1.0;
1302 unpack_RG_UINT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1304 const GLushort
*s
= (const GLushort
*) src
;
1306 for (i
= 0; i
< n
; i
++) {
1307 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1308 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1309 dst
[i
][BCOMP
] = 0.0;
1310 dst
[i
][ACOMP
] = 1.0;
1315 unpack_RGB_UINT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1317 const GLushort
*s
= (const GLushort
*) src
;
1319 for (i
= 0; i
< n
; i
++) {
1320 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1321 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1322 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1323 dst
[i
][ACOMP
] = 1.0;
1328 unpack_RGBA_UINT16(const void *src
, GLfloat dst
[][4], GLuint n
)
1330 const GLushort
*s
= (const GLushort
*) src
;
1332 for (i
= 0; i
< n
; i
++) {
1333 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1334 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1335 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1336 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1341 unpack_R_UINT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1343 const GLuint
*s
= (const GLuint
*) src
;
1345 for (i
= 0; i
< n
; i
++) {
1346 dst
[i
][RCOMP
] = (GLfloat
) s
[i
];
1347 dst
[i
][GCOMP
] = 0.0;
1348 dst
[i
][BCOMP
] = 0.0;
1349 dst
[i
][ACOMP
] = 1.0;
1354 unpack_RG_UINT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1356 const GLuint
*s
= (const GLuint
*) src
;
1358 for (i
= 0; i
< n
; i
++) {
1359 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*2+0];
1360 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*2+1];
1361 dst
[i
][BCOMP
] = 0.0;
1362 dst
[i
][ACOMP
] = 1.0;
1367 unpack_RGB_UINT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1369 const GLuint
*s
= (const GLuint
*) src
;
1371 for (i
= 0; i
< n
; i
++) {
1372 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*3+0];
1373 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*3+1];
1374 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*3+2];
1375 dst
[i
][ACOMP
] = 1.0;
1380 unpack_RGBA_UINT32(const void *src
, GLfloat dst
[][4], GLuint n
)
1382 const GLuint
*s
= (const GLuint
*) src
;
1384 for (i
= 0; i
< n
; i
++) {
1385 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1386 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1387 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1388 dst
[i
][ACOMP
] = (GLfloat
) s
[i
*4+3];
1393 unpack_DUDV8(const void *src
, GLfloat dst
[][4], GLuint n
)
1395 const GLbyte
*s
= (const GLbyte
*) src
;
1397 for (i
= 0; i
< n
; i
++) {
1398 dst
[i
][RCOMP
] = BYTE_TO_FLOAT(s
[i
*2+0]);
1399 dst
[i
][GCOMP
] = BYTE_TO_FLOAT(s
[i
*2+1]);
1406 unpack_SIGNED_R8(const void *src
, GLfloat dst
[][4], GLuint n
)
1408 const GLbyte
*s
= ((const GLbyte
*) src
);
1410 for (i
= 0; i
< n
; i
++) {
1411 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( s
[i
] );
1412 dst
[i
][GCOMP
] = 0.0F
;
1413 dst
[i
][BCOMP
] = 0.0F
;
1414 dst
[i
][ACOMP
] = 1.0F
;
1419 unpack_SIGNED_RG88_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
1421 const GLushort
*s
= ((const GLushort
*) src
);
1423 for (i
= 0; i
< n
; i
++) {
1424 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] & 0xff) );
1425 dst
[i
][GCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1426 dst
[i
][BCOMP
] = 0.0F
;
1427 dst
[i
][ACOMP
] = 1.0F
;
1432 unpack_SIGNED_RGBX8888(const void *src
, GLfloat dst
[][4], GLuint n
)
1434 const GLuint
*s
= ((const GLuint
*) src
);
1436 for (i
= 0; i
< n
; i
++) {
1437 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 24) );
1438 dst
[i
][GCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 16) );
1439 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1440 dst
[i
][ACOMP
] = 1.0f
;
1445 unpack_SIGNED_RGBA8888(const void *src
, GLfloat dst
[][4], GLuint n
)
1447 const GLuint
*s
= ((const GLuint
*) src
);
1449 for (i
= 0; i
< n
; i
++) {
1450 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 24) );
1451 dst
[i
][GCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 16) );
1452 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1453 dst
[i
][ACOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] ) );
1458 unpack_SIGNED_RGBA8888_REV(const void *src
, GLfloat dst
[][4], GLuint n
)
1460 const GLuint
*s
= ((const GLuint
*) src
);
1462 for (i
= 0; i
< n
; i
++) {
1463 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] ) );
1464 dst
[i
][GCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1465 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 16) );
1466 dst
[i
][ACOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 24) );
1471 unpack_SIGNED_R16(const void *src
, GLfloat dst
[][4], GLuint n
)
1473 const GLshort
*s
= ((const GLshort
*) src
);
1475 for (i
= 0; i
< n
; i
++) {
1476 dst
[i
][RCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
] );
1477 dst
[i
][GCOMP
] = 0.0F
;
1478 dst
[i
][BCOMP
] = 0.0F
;
1479 dst
[i
][ACOMP
] = 1.0F
;
1484 unpack_SIGNED_GR1616(const void *src
, GLfloat dst
[][4], GLuint n
)
1486 const GLuint
*s
= ((const GLuint
*) src
);
1488 for (i
= 0; i
< n
; i
++) {
1489 dst
[i
][RCOMP
] = SHORT_TO_FLOAT_TEX( (GLshort
) (s
[i
] & 0xffff) );
1490 dst
[i
][GCOMP
] = SHORT_TO_FLOAT_TEX( (GLshort
) (s
[i
] >> 16) );
1491 dst
[i
][BCOMP
] = 0.0F
;
1492 dst
[i
][ACOMP
] = 1.0F
;
1497 unpack_SIGNED_RGB_16(const void *src
, GLfloat dst
[][4], GLuint n
)
1499 const GLshort
*s
= (const GLshort
*) src
;
1501 for (i
= 0; i
< n
; i
++) {
1502 dst
[i
][RCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*3+0] );
1503 dst
[i
][GCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*3+1] );
1504 dst
[i
][BCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*3+2] );
1505 dst
[i
][ACOMP
] = 1.0F
;
1510 unpack_SIGNED_RGBA_16(const void *src
, GLfloat dst
[][4], GLuint n
)
1512 const GLshort
*s
= (const GLshort
*) src
;
1514 for (i
= 0; i
< n
; i
++) {
1515 dst
[i
][RCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+0] );
1516 dst
[i
][GCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+1] );
1517 dst
[i
][BCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+2] );
1518 dst
[i
][ACOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+3] );
1523 unpack_RGBA_16(const void *src
, GLfloat dst
[][4], GLuint n
)
1525 const GLushort
*s
= (const GLushort
*) src
;
1527 for (i
= 0; i
< n
; i
++) {
1528 dst
[i
][RCOMP
] = USHORT_TO_FLOAT( s
[i
*4+0] );
1529 dst
[i
][GCOMP
] = USHORT_TO_FLOAT( s
[i
*4+1] );
1530 dst
[i
][BCOMP
] = USHORT_TO_FLOAT( s
[i
*4+2] );
1531 dst
[i
][ACOMP
] = USHORT_TO_FLOAT( s
[i
*4+3] );
1536 unpack_RED_RGTC1(const void *src
, GLfloat dst
[][4], GLuint n
)
1542 unpack_SIGNED_RED_RGTC1(const void *src
, GLfloat dst
[][4], GLuint n
)
1548 unpack_RG_RGTC2(const void *src
, GLfloat dst
[][4], GLuint n
)
1554 unpack_SIGNED_RG_RGTC2(const void *src
, GLfloat dst
[][4], GLuint n
)
1560 unpack_L_LATC1(const void *src
, GLfloat dst
[][4], GLuint n
)
1566 unpack_SIGNED_L_LATC1(const void *src
, GLfloat dst
[][4], GLuint n
)
1572 unpack_LA_LATC2(const void *src
, GLfloat dst
[][4], GLuint n
)
1578 unpack_SIGNED_LA_LATC2(const void *src
, GLfloat dst
[][4], GLuint n
)
1584 unpack_ETC1_RGB8(const void *src
, GLfloat dst
[][4], GLuint n
)
1590 unpack_ETC2_RGB8(const void *src
, GLfloat dst
[][4], GLuint n
)
1596 unpack_ETC2_SRGB8(const void *src
, GLfloat dst
[][4], GLuint n
)
1602 unpack_ETC2_RGBA8_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1608 unpack_ETC2_SRGB8_ALPHA8_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1614 unpack_ETC2_R11_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1620 unpack_ETC2_RG11_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1626 unpack_ETC2_SIGNED_R11_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1632 unpack_ETC2_SIGNED_RG11_EAC(const void *src
, GLfloat dst
[][4], GLuint n
)
1638 unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1(const void *src
, GLfloat dst
[][4],
1645 unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1(const void *src
, GLfloat dst
[][4],
1652 unpack_SIGNED_A8(const void *src
, GLfloat dst
[][4], GLuint n
)
1654 const GLbyte
*s
= ((const GLbyte
*) src
);
1656 for (i
= 0; i
< n
; i
++) {
1657 dst
[i
][RCOMP
] = 0.0F
;
1658 dst
[i
][GCOMP
] = 0.0F
;
1659 dst
[i
][BCOMP
] = 0.0F
;
1660 dst
[i
][ACOMP
] = BYTE_TO_FLOAT_TEX( s
[i
] );
1665 unpack_SIGNED_L8(const void *src
, GLfloat dst
[][4], GLuint n
)
1667 const GLbyte
*s
= ((const GLbyte
*) src
);
1669 for (i
= 0; i
< n
; i
++) {
1672 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( s
[i
] );
1673 dst
[i
][ACOMP
] = 1.0F
;
1678 unpack_SIGNED_AL88(const void *src
, GLfloat dst
[][4], GLuint n
)
1680 const GLshort
*s
= ((const GLshort
*) src
);
1682 for (i
= 0; i
< n
; i
++) {
1685 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] & 0xff) );
1686 dst
[i
][ACOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1691 unpack_SIGNED_I8(const void *src
, GLfloat dst
[][4], GLuint n
)
1693 const GLbyte
*s
= ((const GLbyte
*) src
);
1695 for (i
= 0; i
< n
; i
++) {
1699 dst
[i
][ACOMP
] = BYTE_TO_FLOAT_TEX( s
[i
] );
1704 unpack_SIGNED_A16(const void *src
, GLfloat dst
[][4], GLuint n
)
1706 const GLshort
*s
= ((const GLshort
*) src
);
1708 for (i
= 0; i
< n
; i
++) {
1709 dst
[i
][RCOMP
] = 0.0F
;
1710 dst
[i
][GCOMP
] = 0.0F
;
1711 dst
[i
][BCOMP
] = 0.0F
;
1712 dst
[i
][ACOMP
] = SHORT_TO_FLOAT_TEX( s
[i
] );
1717 unpack_SIGNED_L16(const void *src
, GLfloat dst
[][4], GLuint n
)
1719 const GLshort
*s
= ((const GLshort
*) src
);
1721 for (i
= 0; i
< n
; i
++) {
1724 dst
[i
][BCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
] );
1725 dst
[i
][ACOMP
] = 1.0F
;
1730 unpack_SIGNED_AL1616(const void *src
, GLfloat dst
[][4], GLuint n
)
1732 const GLshort
*s
= (const GLshort
*) src
;
1734 for (i
= 0; i
< n
; i
++) {
1737 dst
[i
][BCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*2+0] );
1738 dst
[i
][ACOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*2+1] );
1743 unpack_SIGNED_I16(const void *src
, GLfloat dst
[][4], GLuint n
)
1745 const GLshort
*s
= ((const GLshort
*) src
);
1747 for (i
= 0; i
< n
; i
++) {
1751 dst
[i
][ACOMP
] = SHORT_TO_FLOAT_TEX( s
[i
] );
1756 unpack_RGB9_E5_FLOAT(const void *src
, GLfloat dst
[][4], GLuint n
)
1758 const GLuint
*s
= (const GLuint
*) src
;
1760 for (i
= 0; i
< n
; i
++) {
1761 rgb9e5_to_float3(s
[i
], dst
[i
]);
1762 dst
[i
][ACOMP
] = 1.0F
;
1767 unpack_R11_G11_B10_FLOAT(const void *src
, GLfloat dst
[][4], GLuint n
)
1769 const GLuint
*s
= (const GLuint
*) src
;
1771 for (i
= 0; i
< n
; i
++) {
1772 r11g11b10f_to_float3(s
[i
], dst
[i
]);
1773 dst
[i
][ACOMP
] = 1.0F
;
1778 unpack_XRGB4444_UNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1780 const GLushort
*s
= ((const GLushort
*) src
);
1782 for (i
= 0; i
< n
; i
++) {
1783 dst
[i
][RCOMP
] = ((s
[i
] >> 8) & 0xf) * (1.0F
/ 15.0F
);
1784 dst
[i
][GCOMP
] = ((s
[i
] >> 4) & 0xf) * (1.0F
/ 15.0F
);
1785 dst
[i
][BCOMP
] = ((s
[i
] ) & 0xf) * (1.0F
/ 15.0F
);
1786 dst
[i
][ACOMP
] = 1.0;
1791 unpack_XRGB1555_UNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1793 const GLushort
*s
= ((const GLushort
*) src
);
1795 for (i
= 0; i
< n
; i
++) {
1796 dst
[i
][RCOMP
] = ((s
[i
] >> 10) & 0x1f) * (1.0F
/ 31.0F
);
1797 dst
[i
][GCOMP
] = ((s
[i
] >> 5) & 0x1f) * (1.0F
/ 31.0F
);
1798 dst
[i
][BCOMP
] = ((s
[i
] >> 0) & 0x1f) * (1.0F
/ 31.0F
);
1799 dst
[i
][ACOMP
] = 1.0;
1804 unpack_XBGR8888_SNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1806 const GLuint
*s
= ((const GLuint
*) src
);
1808 for (i
= 0; i
< n
; i
++) {
1809 dst
[i
][RCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] ) );
1810 dst
[i
][GCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 8) );
1811 dst
[i
][BCOMP
] = BYTE_TO_FLOAT_TEX( (GLbyte
) (s
[i
] >> 16) );
1812 dst
[i
][ACOMP
] = 1.0;
1817 unpack_XBGR8888_SRGB(const void *src
, GLfloat dst
[][4], GLuint n
)
1819 const GLuint
*s
= ((const GLuint
*) src
);
1821 for (i
= 0; i
< n
; i
++) {
1822 dst
[i
][RCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] ) & 0xff );
1823 dst
[i
][GCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 8) & 0xff );
1824 dst
[i
][BCOMP
] = _mesa_nonlinear_to_linear( (s
[i
] >> 16) & 0xff );
1825 dst
[i
][ACOMP
] = UBYTE_TO_FLOAT( s
[i
] >> 24 ); /* linear! */
1830 unpack_XBGR8888_UINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1832 const GLbyte
*s
= (const GLbyte
*) src
;
1834 for (i
= 0; i
< n
; i
++) {
1835 dst
[i
][RCOMP
] = s
[i
*4+0];
1836 dst
[i
][GCOMP
] = s
[i
*4+1];
1837 dst
[i
][BCOMP
] = s
[i
*4+2];
1838 dst
[i
][ACOMP
] = 1.0;
1843 unpack_XBGR8888_SINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1845 const GLbyte
*s
= (const GLbyte
*) src
;
1847 for (i
= 0; i
< n
; i
++) {
1848 dst
[i
][RCOMP
] = s
[i
*4+0];
1849 dst
[i
][GCOMP
] = s
[i
*4+1];
1850 dst
[i
][BCOMP
] = s
[i
*4+2];
1851 dst
[i
][ACOMP
] = 1.0;
1856 unpack_XRGB2101010_UNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1858 const GLuint
*s
= ((const GLuint
*) src
);
1860 for (i
= 0; i
< n
; i
++) {
1861 dst
[i
][RCOMP
] = ((s
[i
] >> 20) & 0x3ff) * (1.0F
/ 1023.0F
);
1862 dst
[i
][GCOMP
] = ((s
[i
] >> 10) & 0x3ff) * (1.0F
/ 1023.0F
);
1863 dst
[i
][BCOMP
] = ((s
[i
] >> 0) & 0x3ff) * (1.0F
/ 1023.0F
);
1864 dst
[i
][ACOMP
] = 1.0;
1869 unpack_XBGR16161616_UNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1871 const GLushort
*s
= (const GLushort
*) src
;
1873 for (i
= 0; i
< n
; i
++) {
1874 dst
[i
][RCOMP
] = USHORT_TO_FLOAT( s
[i
*4+0] );
1875 dst
[i
][GCOMP
] = USHORT_TO_FLOAT( s
[i
*4+1] );
1876 dst
[i
][BCOMP
] = USHORT_TO_FLOAT( s
[i
*4+2] );
1877 dst
[i
][ACOMP
] = 1.0;
1882 unpack_XBGR16161616_SNORM(const void *src
, GLfloat dst
[][4], GLuint n
)
1884 const GLshort
*s
= (const GLshort
*) src
;
1886 for (i
= 0; i
< n
; i
++) {
1887 dst
[i
][RCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+0] );
1888 dst
[i
][GCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+1] );
1889 dst
[i
][BCOMP
] = SHORT_TO_FLOAT_TEX( s
[i
*4+2] );
1890 dst
[i
][ACOMP
] = 1.0;
1895 unpack_XBGR16161616_FLOAT(const void *src
, GLfloat dst
[][4], GLuint n
)
1897 const GLshort
*s
= (const GLshort
*) src
;
1899 for (i
= 0; i
< n
; i
++) {
1900 dst
[i
][RCOMP
] = _mesa_half_to_float(s
[i
*4+0]);
1901 dst
[i
][GCOMP
] = _mesa_half_to_float(s
[i
*4+1]);
1902 dst
[i
][BCOMP
] = _mesa_half_to_float(s
[i
*4+2]);
1903 dst
[i
][ACOMP
] = 1.0;
1908 unpack_XBGR16161616_UINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1910 const GLushort
*s
= (const GLushort
*) src
;
1912 for (i
= 0; i
< n
; i
++) {
1913 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1914 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1915 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1916 dst
[i
][ACOMP
] = 1.0;
1921 unpack_XBGR16161616_SINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1923 const GLshort
*s
= (const GLshort
*) src
;
1925 for (i
= 0; i
< n
; i
++) {
1926 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1927 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1928 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1929 dst
[i
][ACOMP
] = 1.0;
1934 unpack_XBGR32323232_FLOAT(const void *src
, GLfloat dst
[][4], GLuint n
)
1936 const GLfloat
*s
= (const GLfloat
*) src
;
1938 for (i
= 0; i
< n
; i
++) {
1939 dst
[i
][RCOMP
] = s
[i
*4+0];
1940 dst
[i
][GCOMP
] = s
[i
*4+1];
1941 dst
[i
][BCOMP
] = s
[i
*4+2];
1942 dst
[i
][ACOMP
] = 1.0;
1947 unpack_XBGR32323232_UINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1949 const GLuint
*s
= (const GLuint
*) src
;
1951 for (i
= 0; i
< n
; i
++) {
1952 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1953 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1954 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1955 dst
[i
][ACOMP
] = 1.0;
1960 unpack_XBGR32323232_SINT(const void *src
, GLfloat dst
[][4], GLuint n
)
1962 const GLint
*s
= (const GLint
*) src
;
1964 for (i
= 0; i
< n
; i
++) {
1965 dst
[i
][RCOMP
] = (GLfloat
) s
[i
*4+0];
1966 dst
[i
][GCOMP
] = (GLfloat
) s
[i
*4+1];
1967 dst
[i
][BCOMP
] = (GLfloat
) s
[i
*4+2];
1968 dst
[i
][ACOMP
] = 1.0;
1974 * Return the unpacker function for the given format.
1976 static unpack_rgba_func
1977 get_unpack_rgba_function(gl_format format
)
1979 static unpack_rgba_func table
[MESA_FORMAT_COUNT
];
1980 static GLboolean initialized
= GL_FALSE
;
1983 table
[MESA_FORMAT_NONE
] = NULL
;
1985 table
[MESA_FORMAT_RGBA8888
] = unpack_RGBA8888
;
1986 table
[MESA_FORMAT_RGBA8888_REV
] = unpack_RGBA8888_REV
;
1987 table
[MESA_FORMAT_ARGB8888
] = unpack_ARGB8888
;
1988 table
[MESA_FORMAT_ARGB8888_REV
] = unpack_ARGB8888_REV
;
1989 table
[MESA_FORMAT_RGBX8888
] = unpack_RGBX8888
;
1990 table
[MESA_FORMAT_RGBX8888_REV
] = unpack_RGBX8888_REV
;
1991 table
[MESA_FORMAT_XRGB8888
] = unpack_XRGB8888
;
1992 table
[MESA_FORMAT_XRGB8888_REV
] = unpack_XRGB8888_REV
;
1993 table
[MESA_FORMAT_RGB888
] = unpack_RGB888
;
1994 table
[MESA_FORMAT_BGR888
] = unpack_BGR888
;
1995 table
[MESA_FORMAT_RGB565
] = unpack_RGB565
;
1996 table
[MESA_FORMAT_RGB565_REV
] = unpack_RGB565_REV
;
1997 table
[MESA_FORMAT_ARGB4444
] = unpack_ARGB4444
;
1998 table
[MESA_FORMAT_ARGB4444_REV
] = unpack_ARGB4444_REV
;
1999 table
[MESA_FORMAT_RGBA5551
] = unpack_RGBA5551
;
2000 table
[MESA_FORMAT_ARGB1555
] = unpack_ARGB1555
;
2001 table
[MESA_FORMAT_ARGB1555_REV
] = unpack_ARGB1555_REV
;
2002 table
[MESA_FORMAT_AL44
] = unpack_AL44
;
2003 table
[MESA_FORMAT_AL88
] = unpack_AL88
;
2004 table
[MESA_FORMAT_AL88_REV
] = unpack_AL88_REV
;
2005 table
[MESA_FORMAT_AL1616
] = unpack_AL1616
;
2006 table
[MESA_FORMAT_AL1616_REV
] = unpack_AL1616_REV
;
2007 table
[MESA_FORMAT_RGB332
] = unpack_RGB332
;
2008 table
[MESA_FORMAT_A8
] = unpack_A8
;
2009 table
[MESA_FORMAT_A16
] = unpack_A16
;
2010 table
[MESA_FORMAT_L8
] = unpack_L8
;
2011 table
[MESA_FORMAT_L16
] = unpack_L16
;
2012 table
[MESA_FORMAT_I8
] = unpack_I8
;
2013 table
[MESA_FORMAT_I16
] = unpack_I16
;
2014 table
[MESA_FORMAT_YCBCR
] = unpack_YCBCR
;
2015 table
[MESA_FORMAT_YCBCR_REV
] = unpack_YCBCR_REV
;
2016 table
[MESA_FORMAT_R8
] = unpack_R8
;
2017 table
[MESA_FORMAT_GR88
] = unpack_GR88
;
2018 table
[MESA_FORMAT_RG88
] = unpack_RG88
;
2019 table
[MESA_FORMAT_R16
] = unpack_R16
;
2020 table
[MESA_FORMAT_GR1616
] = unpack_GR1616
;
2021 table
[MESA_FORMAT_RG1616
] = unpack_RG1616
;
2022 table
[MESA_FORMAT_ARGB2101010
] = unpack_ARGB2101010
;
2023 table
[MESA_FORMAT_ARGB2101010_UINT
] = unpack_ARGB2101010_UINT
;
2024 table
[MESA_FORMAT_ABGR2101010_UINT
] = unpack_ABGR2101010_UINT
;
2025 table
[MESA_FORMAT_Z24_S8
] = unpack_Z24_S8
;
2026 table
[MESA_FORMAT_S8_Z24
] = unpack_S8_Z24
;
2027 table
[MESA_FORMAT_Z16
] = unpack_Z16
;
2028 table
[MESA_FORMAT_X8_Z24
] = unpack_X8_Z24
;
2029 table
[MESA_FORMAT_Z24_X8
] = unpack_Z24_X8
;
2030 table
[MESA_FORMAT_Z32
] = unpack_Z32
;
2031 table
[MESA_FORMAT_S8
] = unpack_S8
;
2032 table
[MESA_FORMAT_SRGB8
] = unpack_SRGB8
;
2033 table
[MESA_FORMAT_SRGBA8
] = unpack_SRGBA8
;
2034 table
[MESA_FORMAT_SARGB8
] = unpack_SARGB8
;
2035 table
[MESA_FORMAT_SL8
] = unpack_SL8
;
2036 table
[MESA_FORMAT_SLA8
] = unpack_SLA8
;
2037 table
[MESA_FORMAT_SRGB_DXT1
] = unpack_SRGB_DXT1
;
2038 table
[MESA_FORMAT_SRGBA_DXT1
] = unpack_SRGBA_DXT1
;
2039 table
[MESA_FORMAT_SRGBA_DXT3
] = unpack_SRGBA_DXT3
;
2040 table
[MESA_FORMAT_SRGBA_DXT5
] = unpack_SRGBA_DXT5
;
2042 table
[MESA_FORMAT_RGB_FXT1
] = unpack_RGB_FXT1
;
2043 table
[MESA_FORMAT_RGBA_FXT1
] = unpack_RGBA_FXT1
;
2044 table
[MESA_FORMAT_RGB_DXT1
] = unpack_RGB_DXT1
;
2045 table
[MESA_FORMAT_RGBA_DXT1
] = unpack_RGBA_DXT1
;
2046 table
[MESA_FORMAT_RGBA_DXT3
] = unpack_RGBA_DXT3
;
2047 table
[MESA_FORMAT_RGBA_DXT5
] = unpack_RGBA_DXT5
;
2049 table
[MESA_FORMAT_RGBA_FLOAT32
] = unpack_RGBA_FLOAT32
;
2050 table
[MESA_FORMAT_RGBA_FLOAT16
] = unpack_RGBA_FLOAT16
;
2051 table
[MESA_FORMAT_RGB_FLOAT32
] = unpack_RGB_FLOAT32
;
2052 table
[MESA_FORMAT_RGB_FLOAT16
] = unpack_RGB_FLOAT16
;
2053 table
[MESA_FORMAT_ALPHA_FLOAT32
] = unpack_ALPHA_FLOAT32
;
2054 table
[MESA_FORMAT_ALPHA_FLOAT16
] = unpack_ALPHA_FLOAT16
;
2055 table
[MESA_FORMAT_LUMINANCE_FLOAT32
] = unpack_LUMINANCE_FLOAT32
;
2056 table
[MESA_FORMAT_LUMINANCE_FLOAT16
] = unpack_LUMINANCE_FLOAT16
;
2057 table
[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
] = unpack_LUMINANCE_ALPHA_FLOAT32
;
2058 table
[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
] = unpack_LUMINANCE_ALPHA_FLOAT16
;
2059 table
[MESA_FORMAT_INTENSITY_FLOAT32
] = unpack_INTENSITY_FLOAT32
;
2060 table
[MESA_FORMAT_INTENSITY_FLOAT16
] = unpack_INTENSITY_FLOAT16
;
2061 table
[MESA_FORMAT_R_FLOAT32
] = unpack_R_FLOAT32
;
2062 table
[MESA_FORMAT_R_FLOAT16
] = unpack_R_FLOAT16
;
2063 table
[MESA_FORMAT_RG_FLOAT32
] = unpack_RG_FLOAT32
;
2064 table
[MESA_FORMAT_RG_FLOAT16
] = unpack_RG_FLOAT16
;
2066 table
[MESA_FORMAT_R_INT8
] = unpack_R_INT8
;
2067 table
[MESA_FORMAT_RG_INT8
] = unpack_RG_INT8
;
2068 table
[MESA_FORMAT_RGB_INT8
] = unpack_RGB_INT8
;
2069 table
[MESA_FORMAT_RGBA_INT8
] = unpack_RGBA_INT8
;
2070 table
[MESA_FORMAT_R_INT16
] = unpack_R_INT16
;
2071 table
[MESA_FORMAT_RG_INT16
] = unpack_RG_INT16
;
2072 table
[MESA_FORMAT_RGB_INT16
] = unpack_RGB_INT16
;
2073 table
[MESA_FORMAT_RGBA_INT16
] = unpack_RGBA_INT16
;
2074 table
[MESA_FORMAT_R_INT32
] = unpack_R_INT32
;
2075 table
[MESA_FORMAT_RG_INT32
] = unpack_RG_INT32
;
2076 table
[MESA_FORMAT_RGB_INT32
] = unpack_RGB_INT32
;
2077 table
[MESA_FORMAT_RGBA_INT32
] = unpack_RGBA_INT32
;
2078 table
[MESA_FORMAT_R_UINT8
] = unpack_R_UINT8
;
2079 table
[MESA_FORMAT_RG_UINT8
] = unpack_RG_UINT8
;
2080 table
[MESA_FORMAT_RGB_UINT8
] = unpack_RGB_UINT8
;
2081 table
[MESA_FORMAT_RGBA_UINT8
] = unpack_RGBA_UINT8
;
2082 table
[MESA_FORMAT_R_UINT16
] = unpack_R_UINT16
;
2083 table
[MESA_FORMAT_RG_UINT16
] = unpack_RG_UINT16
;
2084 table
[MESA_FORMAT_RGB_UINT16
] = unpack_RGB_UINT16
;
2085 table
[MESA_FORMAT_RGBA_UINT16
] = unpack_RGBA_UINT16
;
2086 table
[MESA_FORMAT_R_UINT32
] = unpack_R_UINT32
;
2087 table
[MESA_FORMAT_RG_UINT32
] = unpack_RG_UINT32
;
2088 table
[MESA_FORMAT_RGB_UINT32
] = unpack_RGB_UINT32
;
2089 table
[MESA_FORMAT_RGBA_UINT32
] = unpack_RGBA_UINT32
;
2091 table
[MESA_FORMAT_DUDV8
] = unpack_DUDV8
;
2092 table
[MESA_FORMAT_SIGNED_R8
] = unpack_SIGNED_R8
;
2093 table
[MESA_FORMAT_SIGNED_RG88_REV
] = unpack_SIGNED_RG88_REV
;
2094 table
[MESA_FORMAT_SIGNED_RGBX8888
] = unpack_SIGNED_RGBX8888
;
2095 table
[MESA_FORMAT_SIGNED_RGBA8888
] = unpack_SIGNED_RGBA8888
;
2096 table
[MESA_FORMAT_SIGNED_RGBA8888_REV
] = unpack_SIGNED_RGBA8888_REV
;
2097 table
[MESA_FORMAT_SIGNED_R16
] = unpack_SIGNED_R16
;
2098 table
[MESA_FORMAT_SIGNED_GR1616
] = unpack_SIGNED_GR1616
;
2099 table
[MESA_FORMAT_SIGNED_RGB_16
] = unpack_SIGNED_RGB_16
;
2100 table
[MESA_FORMAT_SIGNED_RGBA_16
] = unpack_SIGNED_RGBA_16
;
2101 table
[MESA_FORMAT_RGBA_16
] = unpack_RGBA_16
;
2103 table
[MESA_FORMAT_RED_RGTC1
] = unpack_RED_RGTC1
;
2104 table
[MESA_FORMAT_SIGNED_RED_RGTC1
] = unpack_SIGNED_RED_RGTC1
;
2105 table
[MESA_FORMAT_RG_RGTC2
] = unpack_RG_RGTC2
;
2106 table
[MESA_FORMAT_SIGNED_RG_RGTC2
] = unpack_SIGNED_RG_RGTC2
;
2108 table
[MESA_FORMAT_L_LATC1
] = unpack_L_LATC1
;
2109 table
[MESA_FORMAT_SIGNED_L_LATC1
] = unpack_SIGNED_L_LATC1
;
2110 table
[MESA_FORMAT_LA_LATC2
] = unpack_LA_LATC2
;
2111 table
[MESA_FORMAT_SIGNED_LA_LATC2
] = unpack_SIGNED_LA_LATC2
;
2113 table
[MESA_FORMAT_ETC1_RGB8
] = unpack_ETC1_RGB8
;
2114 table
[MESA_FORMAT_ETC2_RGB8
] = unpack_ETC2_RGB8
;
2115 table
[MESA_FORMAT_ETC2_SRGB8
] = unpack_ETC2_SRGB8
;
2116 table
[MESA_FORMAT_ETC2_RGBA8_EAC
] = unpack_ETC2_RGBA8_EAC
;
2117 table
[MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC
] = unpack_ETC2_SRGB8_ALPHA8_EAC
;
2118 table
[MESA_FORMAT_ETC2_R11_EAC
] = unpack_ETC2_R11_EAC
;
2119 table
[MESA_FORMAT_ETC2_RG11_EAC
] = unpack_ETC2_RG11_EAC
;
2120 table
[MESA_FORMAT_ETC2_SIGNED_R11_EAC
] = unpack_ETC2_SIGNED_R11_EAC
;
2121 table
[MESA_FORMAT_ETC2_SIGNED_RG11_EAC
] = unpack_ETC2_SIGNED_RG11_EAC
;
2122 table
[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1
] =
2123 unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1
;
2124 table
[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1
] =
2125 unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1
;
2126 table
[MESA_FORMAT_SIGNED_A8
] = unpack_SIGNED_A8
;
2127 table
[MESA_FORMAT_SIGNED_L8
] = unpack_SIGNED_L8
;
2128 table
[MESA_FORMAT_SIGNED_AL88
] = unpack_SIGNED_AL88
;
2129 table
[MESA_FORMAT_SIGNED_I8
] = unpack_SIGNED_I8
;
2130 table
[MESA_FORMAT_SIGNED_A16
] = unpack_SIGNED_A16
;
2131 table
[MESA_FORMAT_SIGNED_L16
] = unpack_SIGNED_L16
;
2132 table
[MESA_FORMAT_SIGNED_AL1616
] = unpack_SIGNED_AL1616
;
2133 table
[MESA_FORMAT_SIGNED_I16
] = unpack_SIGNED_I16
;
2135 table
[MESA_FORMAT_RGB9_E5_FLOAT
] = unpack_RGB9_E5_FLOAT
;
2136 table
[MESA_FORMAT_R11_G11_B10_FLOAT
] = unpack_R11_G11_B10_FLOAT
;
2138 table
[MESA_FORMAT_Z32_FLOAT
] = unpack_Z32_FLOAT
;
2139 table
[MESA_FORMAT_Z32_FLOAT_X24S8
] = unpack_Z32_FLOAT_X24S8
;
2141 table
[MESA_FORMAT_XRGB4444_UNORM
] = unpack_XRGB4444_UNORM
;
2142 table
[MESA_FORMAT_XRGB1555_UNORM
] = unpack_XRGB1555_UNORM
;
2143 table
[MESA_FORMAT_XBGR8888_SNORM
] = unpack_XBGR8888_SNORM
;
2144 table
[MESA_FORMAT_XBGR8888_SRGB
] = unpack_XBGR8888_SRGB
;
2145 table
[MESA_FORMAT_XBGR8888_UINT
] = unpack_XBGR8888_UINT
;
2146 table
[MESA_FORMAT_XBGR8888_SINT
] = unpack_XBGR8888_SINT
;
2147 table
[MESA_FORMAT_XRGB2101010_UNORM
] = unpack_XRGB2101010_UNORM
;
2148 table
[MESA_FORMAT_XBGR16161616_UNORM
] = unpack_XBGR16161616_UNORM
;
2149 table
[MESA_FORMAT_XBGR16161616_SNORM
] = unpack_XBGR16161616_SNORM
;
2150 table
[MESA_FORMAT_XBGR16161616_FLOAT
] = unpack_XBGR16161616_FLOAT
;
2151 table
[MESA_FORMAT_XBGR16161616_UINT
] = unpack_XBGR16161616_UINT
;
2152 table
[MESA_FORMAT_XBGR16161616_SINT
] = unpack_XBGR16161616_SINT
;
2153 table
[MESA_FORMAT_XBGR32323232_FLOAT
] = unpack_XBGR32323232_FLOAT
;
2154 table
[MESA_FORMAT_XBGR32323232_UINT
] = unpack_XBGR32323232_UINT
;
2155 table
[MESA_FORMAT_XBGR32323232_SINT
] = unpack_XBGR32323232_SINT
;
2157 initialized
= GL_TRUE
;
2160 if (table
[format
] == NULL
) {
2161 _mesa_problem(NULL
, "unsupported unpack for format %s",
2162 _mesa_get_format_name(format
));
2165 return table
[format
];
2170 * Unpack rgba colors, returning as GLfloat values.
2173 _mesa_unpack_rgba_row(gl_format format
, GLuint n
,
2174 const void *src
, GLfloat dst
[][4])
2176 unpack_rgba_func unpack
= get_unpack_rgba_function(format
);
2177 unpack(src
, dst
, n
);
2181 /**********************************************************************/
2182 /* Unpack, returning GLubyte colors */
2183 /**********************************************************************/
2187 unpack_ubyte_RGBA8888(const void *src
, GLubyte dst
[][4], GLuint n
)
2189 const GLuint
*s
= ((const GLuint
*) src
);
2191 for (i
= 0; i
< n
; i
++) {
2192 dst
[i
][RCOMP
] = (s
[i
] >> 24);
2193 dst
[i
][GCOMP
] = (s
[i
] >> 16) & 0xff;
2194 dst
[i
][BCOMP
] = (s
[i
] >> 8) & 0xff;
2195 dst
[i
][ACOMP
] = (s
[i
] ) & 0xff;
2200 unpack_ubyte_RGBA8888_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2202 const GLuint
*s
= ((const GLuint
*) src
);
2204 for (i
= 0; i
< n
; i
++) {
2205 dst
[i
][RCOMP
] = (s
[i
] ) & 0xff;
2206 dst
[i
][GCOMP
] = (s
[i
] >> 8) & 0xff;
2207 dst
[i
][BCOMP
] = (s
[i
] >> 16) & 0xff;
2208 dst
[i
][ACOMP
] = (s
[i
] >> 24);
2213 unpack_ubyte_ARGB8888(const void *src
, GLubyte dst
[][4], GLuint n
)
2215 const GLuint
*s
= ((const GLuint
*) src
);
2217 for (i
= 0; i
< n
; i
++) {
2218 dst
[i
][RCOMP
] = (s
[i
] >> 16) & 0xff;
2219 dst
[i
][GCOMP
] = (s
[i
] >> 8) & 0xff;
2220 dst
[i
][BCOMP
] = (s
[i
] ) & 0xff;
2221 dst
[i
][ACOMP
] = (s
[i
] >> 24);
2226 unpack_ubyte_ARGB8888_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2228 const GLuint
*s
= ((const GLuint
*) src
);
2230 for (i
= 0; i
< n
; i
++) {
2231 dst
[i
][RCOMP
] = (s
[i
] >> 8) & 0xff;
2232 dst
[i
][GCOMP
] = (s
[i
] >> 16) & 0xff;
2233 dst
[i
][BCOMP
] = (s
[i
] >> 24);
2234 dst
[i
][ACOMP
] = (s
[i
] ) & 0xff;
2239 unpack_ubyte_RGBX8888(const void *src
, GLubyte dst
[][4], GLuint n
)
2241 const GLuint
*s
= ((const GLuint
*) src
);
2243 for (i
= 0; i
< n
; i
++) {
2244 dst
[i
][RCOMP
] = (s
[i
] >> 24);
2245 dst
[i
][GCOMP
] = (s
[i
] >> 16) & 0xff;
2246 dst
[i
][BCOMP
] = (s
[i
] >> 8) & 0xff;
2247 dst
[i
][ACOMP
] = 0xff;
2252 unpack_ubyte_RGBX8888_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2254 const GLuint
*s
= ((const GLuint
*) src
);
2256 for (i
= 0; i
< n
; i
++) {
2257 dst
[i
][RCOMP
] = (s
[i
] ) & 0xff;
2258 dst
[i
][GCOMP
] = (s
[i
] >> 8) & 0xff;
2259 dst
[i
][BCOMP
] = (s
[i
] >> 16) & 0xff;
2260 dst
[i
][ACOMP
] = 0xff;
2265 unpack_ubyte_XRGB8888(const void *src
, GLubyte dst
[][4], GLuint n
)
2267 const GLuint
*s
= ((const GLuint
*) src
);
2269 for (i
= 0; i
< n
; i
++) {
2270 dst
[i
][RCOMP
] = (s
[i
] >> 16) & 0xff;
2271 dst
[i
][GCOMP
] = (s
[i
] >> 8) & 0xff;
2272 dst
[i
][BCOMP
] = (s
[i
] ) & 0xff;
2273 dst
[i
][ACOMP
] = 0xff;
2278 unpack_ubyte_XRGB8888_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2280 const GLuint
*s
= ((const GLuint
*) src
);
2282 for (i
= 0; i
< n
; i
++) {
2283 dst
[i
][RCOMP
] = (s
[i
] >> 8) & 0xff;
2284 dst
[i
][GCOMP
] = (s
[i
] >> 16) & 0xff;
2285 dst
[i
][BCOMP
] = (s
[i
] >> 24);
2286 dst
[i
][ACOMP
] = 0xff;
2291 unpack_ubyte_RGB888(const void *src
, GLubyte dst
[][4], GLuint n
)
2293 const GLubyte
*s
= (const GLubyte
*) src
;
2295 for (i
= 0; i
< n
; i
++) {
2296 dst
[i
][RCOMP
] = s
[i
*3+2];
2297 dst
[i
][GCOMP
] = s
[i
*3+1];
2298 dst
[i
][BCOMP
] = s
[i
*3+0];
2299 dst
[i
][ACOMP
] = 0xff;
2304 unpack_ubyte_BGR888(const void *src
, GLubyte dst
[][4], GLuint n
)
2306 const GLubyte
*s
= (const GLubyte
*) src
;
2308 for (i
= 0; i
< n
; i
++) {
2309 dst
[i
][RCOMP
] = s
[i
*3+0];
2310 dst
[i
][GCOMP
] = s
[i
*3+1];
2311 dst
[i
][BCOMP
] = s
[i
*3+2];
2312 dst
[i
][ACOMP
] = 0xff;
2317 unpack_ubyte_RGB565(const void *src
, GLubyte dst
[][4], GLuint n
)
2319 const GLushort
*s
= ((const GLushort
*) src
);
2321 for (i
= 0; i
< n
; i
++) {
2322 dst
[i
][RCOMP
] = EXPAND_5_8((s
[i
] >> 11) & 0x1f);
2323 dst
[i
][GCOMP
] = EXPAND_6_8((s
[i
] >> 5 ) & 0x3f);
2324 dst
[i
][BCOMP
] = EXPAND_5_8( s
[i
] & 0x1f);
2325 dst
[i
][ACOMP
] = 0xff;
2330 unpack_ubyte_RGB565_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2332 const GLushort
*s
= ((const GLushort
*) src
);
2334 for (i
= 0; i
< n
; i
++) {
2335 GLuint t
= (s
[i
] >> 8) | (s
[i
] << 8); /* byte swap */
2336 dst
[i
][RCOMP
] = EXPAND_5_8((t
>> 11) & 0x1f);
2337 dst
[i
][GCOMP
] = EXPAND_6_8((t
>> 5 ) & 0x3f);
2338 dst
[i
][BCOMP
] = EXPAND_5_8( t
& 0x1f);
2339 dst
[i
][ACOMP
] = 0xff;
2344 unpack_ubyte_ARGB4444(const void *src
, GLubyte dst
[][4], GLuint n
)
2346 const GLushort
*s
= ((const GLushort
*) src
);
2348 for (i
= 0; i
< n
; i
++) {
2349 dst
[i
][RCOMP
] = EXPAND_4_8((s
[i
] >> 8) & 0xf);
2350 dst
[i
][GCOMP
] = EXPAND_4_8((s
[i
] >> 4) & 0xf);
2351 dst
[i
][BCOMP
] = EXPAND_4_8((s
[i
] ) & 0xf);
2352 dst
[i
][ACOMP
] = EXPAND_4_8((s
[i
] >> 12) & 0xf);
2357 unpack_ubyte_ARGB4444_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2359 const GLushort
*s
= ((const GLushort
*) src
);
2361 for (i
= 0; i
< n
; i
++) {
2362 dst
[i
][RCOMP
] = EXPAND_4_8((s
[i
] ) & 0xf);
2363 dst
[i
][GCOMP
] = EXPAND_4_8((s
[i
] >> 12) & 0xf);
2364 dst
[i
][BCOMP
] = EXPAND_4_8((s
[i
] >> 8) & 0xf);
2365 dst
[i
][ACOMP
] = EXPAND_4_8((s
[i
] >> 4) & 0xf);
2370 unpack_ubyte_RGBA5551(const void *src
, GLubyte dst
[][4], GLuint n
)
2372 const GLushort
*s
= ((const GLushort
*) src
);
2374 for (i
= 0; i
< n
; i
++) {
2375 dst
[i
][RCOMP
] = EXPAND_5_8((s
[i
] >> 11) & 0x1f);
2376 dst
[i
][GCOMP
] = EXPAND_5_8((s
[i
] >> 6) & 0x1f);
2377 dst
[i
][BCOMP
] = EXPAND_5_8((s
[i
] >> 1) & 0x1f);
2378 dst
[i
][ACOMP
] = EXPAND_1_8((s
[i
] ) & 0x01);
2383 unpack_ubyte_ARGB1555(const void *src
, GLubyte dst
[][4], GLuint n
)
2385 const GLushort
*s
= ((const GLushort
*) src
);
2387 for (i
= 0; i
< n
; i
++) {
2388 dst
[i
][RCOMP
] = EXPAND_5_8((s
[i
] >> 10) & 0x1f);
2389 dst
[i
][GCOMP
] = EXPAND_5_8((s
[i
] >> 5) & 0x1f);
2390 dst
[i
][BCOMP
] = EXPAND_5_8((s
[i
] >> 0) & 0x1f);
2391 dst
[i
][ACOMP
] = EXPAND_1_8((s
[i
] >> 15) & 0x01);
2396 unpack_ubyte_ARGB1555_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2398 const GLushort
*s
= ((const GLushort
*) src
);
2400 for (i
= 0; i
< n
; i
++) {
2401 GLushort tmp
= (s
[i
] << 8) | (s
[i
] >> 8); /* byteswap */
2402 dst
[i
][RCOMP
] = EXPAND_5_8((tmp
>> 10) & 0x1f);
2403 dst
[i
][GCOMP
] = EXPAND_5_8((tmp
>> 5) & 0x1f);
2404 dst
[i
][BCOMP
] = EXPAND_5_8((tmp
>> 0) & 0x1f);
2405 dst
[i
][ACOMP
] = EXPAND_1_8((tmp
>> 15) & 0x01);
2410 unpack_ubyte_AL44(const void *src
, GLubyte dst
[][4], GLuint n
)
2412 const GLubyte
*s
= ((const GLubyte
*) src
);
2414 for (i
= 0; i
< n
; i
++) {
2417 dst
[i
][BCOMP
] = EXPAND_4_8(s
[i
] & 0xf);
2418 dst
[i
][ACOMP
] = EXPAND_4_8(s
[i
] >> 4);
2423 unpack_ubyte_AL88(const void *src
, GLubyte dst
[][4], GLuint n
)
2425 const GLushort
*s
= ((const GLushort
*) src
);
2427 for (i
= 0; i
< n
; i
++) {
2430 dst
[i
][BCOMP
] = EXPAND_4_8(s
[i
] & 0xff);
2431 dst
[i
][ACOMP
] = EXPAND_4_8(s
[i
] >> 8);
2436 unpack_ubyte_AL88_REV(const void *src
, GLubyte dst
[][4], GLuint n
)
2438 const GLushort
*s
= ((const GLushort
*) src
);
2440 for (i
= 0; i
< n
; i
++) {
2443 dst
[i
][BCOMP
] = EXPAND_4_8(s
[i
] >> 8);
2444 dst
[i
][ACOMP
] = EXPAND_4_8(s
[i
] & 0xff);
2449 unpack_ubyte_RGB332(const void *src
, GLubyte dst
[][4], GLuint n
)
2451 const GLubyte
*s
= ((const GLubyte
*) src
);
2453 for (i
= 0; i
< n
; i
++) {
2454 dst
[i
][RCOMP
] = EXPAND_3_8((s
[i
] >> 5) & 0x7);
2455 dst
[i
][GCOMP
] = EXPAND_3_8((s
[i
] >> 2) & 0x7);
2456 dst
[i
][BCOMP
] = EXPAND_2_8((s
[i
] ) & 0x3);
2457 dst
[i
][ACOMP
] = 0xff;
2462 unpack_ubyte_A8(const void *src
, GLubyte dst
[][4], GLuint n
)
2464 const GLubyte
*s
= ((const GLubyte
*) src
);
2466 for (i
= 0; i
< n
; i
++) {
2470 dst
[i
][ACOMP
] = s
[i
];
2475 unpack_ubyte_L8(const void *src
, GLubyte dst
[][4], GLuint n
)
2477 const GLubyte
*s
= ((const GLubyte
*) src
);
2479 for (i
= 0; i
< n
; i
++) {
2482 dst
[i
][BCOMP
] = s
[i
];
2483 dst
[i
][ACOMP
] = 0xff;
2489 unpack_ubyte_I8(const void *src
, GLubyte dst
[][4], GLuint n
)
2491 const GLubyte
*s
= ((const GLubyte
*) src
);
2493 for (i
= 0; i
< n
; i
++) {
2497 dst
[i
][ACOMP
] = s
[i
];
2502 unpack_ubyte_R8(const void *src
, GLubyte dst
[][4], GLuint n
)
2504 const GLubyte
*s
= ((const GLubyte
*) src
);
2506 for (i
= 0; i
< n
; i
++) {
2515 unpack_ubyte_GR88(const void *src
, GLubyte dst
[][4], GLuint n
)
2517 const GLushort
*s
= ((const GLushort
*) src
);
2519 for (i
= 0; i
< n
; i
++) {
2520 dst
[i
][RCOMP
] = s
[i
] & 0xff;
2521 dst
[i
][GCOMP
] = s
[i
] >> 8;
2523 dst
[i
][ACOMP
] = 0xff;
2528 unpack_ubyte_RG88(const void *src
, GLubyte dst
[][4], GLuint n
)
2530 const GLushort
*s
= ((const GLushort
*) src
);
2532 for (i
= 0; i
< n
; i
++) {
2533 dst
[i
][RCOMP
] = s
[i
] >> 8;
2534 dst
[i
][GCOMP
] = s
[i
] & 0xff;
2536 dst
[i
][ACOMP
] = 0xff;
2542 * Unpack rgba colors, returning as GLubyte values. This should usually
2543 * only be used for unpacking formats that use 8 bits or less per channel.
2546 _mesa_unpack_ubyte_rgba_row(gl_format format
, GLuint n
,
2547 const void *src
, GLubyte dst
[][4])
2550 case MESA_FORMAT_RGBA8888
:
2551 unpack_ubyte_RGBA8888(src
, dst
, n
);
2553 case MESA_FORMAT_RGBA8888_REV
:
2554 unpack_ubyte_RGBA8888_REV(src
, dst
, n
);
2556 case MESA_FORMAT_ARGB8888
:
2557 unpack_ubyte_ARGB8888(src
, dst
, n
);
2559 case MESA_FORMAT_ARGB8888_REV
:
2560 unpack_ubyte_ARGB8888_REV(src
, dst
, n
);
2562 case MESA_FORMAT_RGBX8888
:
2563 unpack_ubyte_RGBX8888(src
, dst
, n
);
2565 case MESA_FORMAT_RGBX8888_REV
:
2566 unpack_ubyte_RGBX8888_REV(src
, dst
, n
);
2568 case MESA_FORMAT_XRGB8888
:
2569 unpack_ubyte_XRGB8888(src
, dst
, n
);
2571 case MESA_FORMAT_XRGB8888_REV
:
2572 unpack_ubyte_XRGB8888_REV(src
, dst
, n
);
2574 case MESA_FORMAT_RGB888
:
2575 unpack_ubyte_RGB888(src
, dst
, n
);
2577 case MESA_FORMAT_BGR888
:
2578 unpack_ubyte_BGR888(src
, dst
, n
);
2580 case MESA_FORMAT_RGB565
:
2581 unpack_ubyte_RGB565(src
, dst
, n
);
2583 case MESA_FORMAT_RGB565_REV
:
2584 unpack_ubyte_RGB565_REV(src
, dst
, n
);
2586 case MESA_FORMAT_ARGB4444
:
2587 unpack_ubyte_ARGB4444(src
, dst
, n
);
2589 case MESA_FORMAT_ARGB4444_REV
:
2590 unpack_ubyte_ARGB4444_REV(src
, dst
, n
);
2592 case MESA_FORMAT_RGBA5551
:
2593 unpack_ubyte_RGBA5551(src
, dst
, n
);
2595 case MESA_FORMAT_ARGB1555
:
2596 unpack_ubyte_ARGB1555(src
, dst
, n
);
2598 case MESA_FORMAT_ARGB1555_REV
:
2599 unpack_ubyte_ARGB1555_REV(src
, dst
, n
);
2601 case MESA_FORMAT_AL44
:
2602 unpack_ubyte_AL44(src
, dst
, n
);
2604 case MESA_FORMAT_AL88
:
2605 unpack_ubyte_AL88(src
, dst
, n
);
2607 case MESA_FORMAT_AL88_REV
:
2608 unpack_ubyte_AL88_REV(src
, dst
, n
);
2610 case MESA_FORMAT_RGB332
:
2611 unpack_ubyte_RGB332(src
, dst
, n
);
2613 case MESA_FORMAT_A8
:
2614 unpack_ubyte_A8(src
, dst
, n
);
2616 case MESA_FORMAT_L8
:
2617 unpack_ubyte_L8(src
, dst
, n
);
2619 case MESA_FORMAT_I8
:
2620 unpack_ubyte_I8(src
, dst
, n
);
2622 case MESA_FORMAT_R8
:
2623 unpack_ubyte_R8(src
, dst
, n
);
2625 case MESA_FORMAT_GR88
:
2626 unpack_ubyte_GR88(src
, dst
, n
);
2628 case MESA_FORMAT_RG88
:
2629 unpack_ubyte_RG88(src
, dst
, n
);
2632 /* get float values, convert to ubyte */
2634 GLfloat
*tmp
= malloc(n
* 4 * sizeof(GLfloat
));
2637 _mesa_unpack_rgba_row(format
, n
, src
, (GLfloat (*)[4]) tmp
);
2638 for (i
= 0; i
< n
; i
++) {
2639 UNCLAMPED_FLOAT_TO_UBYTE(dst
[i
][0], tmp
[i
*4+0]);
2640 UNCLAMPED_FLOAT_TO_UBYTE(dst
[i
][1], tmp
[i
*4+1]);
2641 UNCLAMPED_FLOAT_TO_UBYTE(dst
[i
][2], tmp
[i
*4+2]);
2642 UNCLAMPED_FLOAT_TO_UBYTE(dst
[i
][3], tmp
[i
*4+3]);
2652 /**********************************************************************/
2653 /* Unpack, returning GLuint colors */
2654 /**********************************************************************/
2657 unpack_int_rgba_RGBA_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2659 memcpy(dst
, src
, n
* 4 * sizeof(GLuint
));
2663 unpack_int_rgba_RGBA_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
2667 for (i
= 0; i
< n
; i
++) {
2668 dst
[i
][0] = src
[i
* 4 + 0];
2669 dst
[i
][1] = src
[i
* 4 + 1];
2670 dst
[i
][2] = src
[i
* 4 + 2];
2671 dst
[i
][3] = src
[i
* 4 + 3];
2676 unpack_int_rgba_RGBA_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
2680 for (i
= 0; i
< n
; i
++) {
2681 dst
[i
][0] = src
[i
* 4 + 0];
2682 dst
[i
][1] = src
[i
* 4 + 1];
2683 dst
[i
][2] = src
[i
* 4 + 2];
2684 dst
[i
][3] = src
[i
* 4 + 3];
2689 unpack_int_rgba_RGBA_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
2693 for (i
= 0; i
< n
; i
++) {
2694 dst
[i
][0] = src
[i
* 4 + 0];
2695 dst
[i
][1] = src
[i
* 4 + 1];
2696 dst
[i
][2] = src
[i
* 4 + 2];
2697 dst
[i
][3] = src
[i
* 4 + 3];
2702 unpack_int_rgba_RGBA_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2706 for (i
= 0; i
< n
; i
++) {
2707 dst
[i
][0] = src
[i
* 4 + 0];
2708 dst
[i
][1] = src
[i
* 4 + 1];
2709 dst
[i
][2] = src
[i
* 4 + 2];
2710 dst
[i
][3] = src
[i
* 4 + 3];
2715 unpack_int_rgba_ARGB8888(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2719 for (i
= 0; i
< n
; i
++) {
2720 dst
[i
][RCOMP
] = (GLubyte
) src
[i
* 4 + 2];
2721 dst
[i
][GCOMP
] = (GLubyte
) src
[i
* 4 + 1];
2722 dst
[i
][BCOMP
] = (GLubyte
) src
[i
* 4 + 0];
2723 dst
[i
][ACOMP
] = (GLubyte
) src
[i
* 4 + 3];
2728 unpack_int_rgba_XRGB8888(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2732 for (i
= 0; i
< n
; i
++) {
2733 dst
[i
][RCOMP
] = (GLubyte
) src
[i
* 4 + 2];
2734 dst
[i
][GCOMP
] = (GLubyte
) src
[i
* 4 + 1];
2735 dst
[i
][BCOMP
] = (GLubyte
) src
[i
* 4 + 0];
2736 dst
[i
][ACOMP
] = (GLubyte
) 0xff;
2741 unpack_int_rgba_RGB_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2745 for (i
= 0; i
< n
; i
++) {
2746 dst
[i
][0] = src
[i
* 3 + 0];
2747 dst
[i
][1] = src
[i
* 3 + 1];
2748 dst
[i
][2] = src
[i
* 3 + 2];
2754 unpack_int_rgba_RGB_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
2758 for (i
= 0; i
< n
; i
++) {
2759 dst
[i
][0] = src
[i
* 3 + 0];
2760 dst
[i
][1] = src
[i
* 3 + 1];
2761 dst
[i
][2] = src
[i
* 3 + 2];
2767 unpack_int_rgba_RGB_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
2771 for (i
= 0; i
< n
; i
++) {
2772 dst
[i
][0] = src
[i
* 3 + 0];
2773 dst
[i
][1] = src
[i
* 3 + 1];
2774 dst
[i
][2] = src
[i
* 3 + 2];
2780 unpack_int_rgba_RGB_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
2784 for (i
= 0; i
< n
; i
++) {
2785 dst
[i
][0] = src
[i
* 3 + 0];
2786 dst
[i
][1] = src
[i
* 3 + 1];
2787 dst
[i
][2] = src
[i
* 3 + 2];
2793 unpack_int_rgba_RGB_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2797 for (i
= 0; i
< n
; i
++) {
2798 dst
[i
][0] = src
[i
* 3 + 0];
2799 dst
[i
][1] = src
[i
* 3 + 1];
2800 dst
[i
][2] = src
[i
* 3 + 2];
2806 unpack_int_rgba_RG_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2810 for (i
= 0; i
< n
; i
++) {
2811 dst
[i
][0] = src
[i
* 2 + 0];
2812 dst
[i
][1] = src
[i
* 2 + 1];
2819 unpack_int_rgba_RG_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
2823 for (i
= 0; i
< n
; i
++) {
2824 dst
[i
][0] = src
[i
* 2 + 0];
2825 dst
[i
][1] = src
[i
* 2 + 1];
2832 unpack_int_rgba_RG_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
2836 for (i
= 0; i
< n
; i
++) {
2837 dst
[i
][0] = src
[i
* 2 + 0];
2838 dst
[i
][1] = src
[i
* 2 + 1];
2845 unpack_int_rgba_RG_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
2849 for (i
= 0; i
< n
; i
++) {
2850 dst
[i
][0] = src
[i
* 2 + 0];
2851 dst
[i
][1] = src
[i
* 2 + 1];
2858 unpack_int_rgba_RG_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2862 for (i
= 0; i
< n
; i
++) {
2863 dst
[i
][0] = src
[i
* 2 + 0];
2864 dst
[i
][1] = src
[i
* 2 + 1];
2871 unpack_int_rgba_R_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2875 for (i
= 0; i
< n
; i
++) {
2884 unpack_int_rgba_R_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
2888 for (i
= 0; i
< n
; i
++) {
2897 unpack_int_rgba_R_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
2901 for (i
= 0; i
< n
; i
++) {
2910 unpack_int_rgba_R_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
2914 for (i
= 0; i
< n
; i
++) {
2923 unpack_int_rgba_R_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2927 for (i
= 0; i
< n
; i
++) {
2936 unpack_int_rgba_ALPHA_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2940 for (i
= 0; i
< n
; i
++) {
2941 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = 0;
2947 unpack_int_rgba_ALPHA_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
2951 for (i
= 0; i
< n
; i
++) {
2952 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = 0;
2958 unpack_int_rgba_ALPHA_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
2962 for (i
= 0; i
< n
; i
++) {
2963 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = 0;
2969 unpack_int_rgba_ALPHA_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
2973 for (i
= 0; i
< n
; i
++) {
2974 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = 0;
2980 unpack_int_rgba_ALPHA_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
2984 for (i
= 0; i
< n
; i
++) {
2985 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = 0;
2991 unpack_int_rgba_LUMINANCE_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
2995 for (i
= 0; i
< n
; i
++) {
2996 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
];
3002 unpack_int_rgba_LUMINANCE_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
3006 for (i
= 0; i
< n
; i
++) {
3007 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
];
3013 unpack_int_rgba_LUMINANCE_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
3017 for (i
= 0; i
< n
; i
++) {
3018 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
];
3024 unpack_int_rgba_LUMINANCE_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
3028 for (i
= 0; i
< n
; i
++) {
3029 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
];
3035 unpack_int_rgba_LUMINANCE_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
3039 for (i
= 0; i
< n
; i
++) {
3040 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
];
3047 unpack_int_rgba_LUMINANCE_ALPHA_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3051 for (i
= 0; i
< n
; i
++) {
3052 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
* 2 + 0];
3053 dst
[i
][3] = src
[i
* 2 + 1];
3058 unpack_int_rgba_LUMINANCE_ALPHA_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
3062 for (i
= 0; i
< n
; i
++) {
3063 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
* 2 + 0];
3064 dst
[i
][3] = src
[i
* 2 + 1];
3069 unpack_int_rgba_LUMINANCE_ALPHA_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
3073 for (i
= 0; i
< n
; i
++) {
3074 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
* 2 + 0];
3075 dst
[i
][3] = src
[i
* 2 + 1];
3080 unpack_int_rgba_LUMINANCE_ALPHA_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
3084 for (i
= 0; i
< n
; i
++) {
3085 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
* 2 + 0];
3086 dst
[i
][3] = src
[i
* 2 + 1];
3091 unpack_int_rgba_LUMINANCE_ALPHA_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
3095 for (i
= 0; i
< n
; i
++) {
3096 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = src
[i
* 2 + 0];
3097 dst
[i
][3] = src
[i
* 2 + 1];
3102 unpack_int_rgba_INTENSITY_UINT32(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3106 for (i
= 0; i
< n
; i
++) {
3107 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = dst
[i
][3] = src
[i
];
3112 unpack_int_rgba_INTENSITY_UINT16(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
3116 for (i
= 0; i
< n
; i
++) {
3117 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = dst
[i
][3] = src
[i
];
3122 unpack_int_rgba_INTENSITY_INT16(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
3126 for (i
= 0; i
< n
; i
++) {
3127 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = dst
[i
][3] = src
[i
];
3132 unpack_int_rgba_INTENSITY_UINT8(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
3136 for (i
= 0; i
< n
; i
++) {
3137 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = dst
[i
][3] = src
[i
];
3142 unpack_int_rgba_INTENSITY_INT8(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
3146 for (i
= 0; i
< n
; i
++) {
3147 dst
[i
][0] = dst
[i
][1] = dst
[i
][2] = dst
[i
][3] = src
[i
];
3152 unpack_int_rgba_ARGB2101010_UINT(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3156 for (i
= 0; i
< n
; i
++) {
3157 GLuint tmp
= src
[i
];
3158 dst
[i
][0] = (tmp
>> 20) & 0x3ff;
3159 dst
[i
][1] = (tmp
>> 10) & 0x3ff;
3160 dst
[i
][2] = (tmp
>> 0) & 0x3ff;
3161 dst
[i
][3] = (tmp
>> 30) & 0x3;
3166 unpack_int_rgba_ABGR2101010_UINT(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3170 for (i
= 0; i
< n
; i
++) {
3171 GLuint tmp
= src
[i
];
3172 dst
[i
][0] = (tmp
>> 0) & 0x3ff;
3173 dst
[i
][1] = (tmp
>> 10) & 0x3ff;
3174 dst
[i
][2] = (tmp
>> 20) & 0x3ff;
3175 dst
[i
][3] = (tmp
>> 30) & 0x3;
3180 unpack_int_rgba_ARGB2101010(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3184 for (i
= 0; i
< n
; i
++) {
3185 GLuint tmp
= src
[i
];
3186 dst
[i
][0] = (tmp
>> 20) & 0x3ff;
3187 dst
[i
][1] = (tmp
>> 10) & 0x3ff;
3188 dst
[i
][2] = (tmp
>> 0) & 0x3ff;
3189 dst
[i
][3] = (tmp
>> 30) & 0x3;
3194 unpack_int_rgba_XBGR8888_UINT(const GLubyte
*src
, GLuint dst
[][4], GLuint n
)
3198 for (i
= 0; i
< n
; i
++) {
3199 dst
[i
][0] = src
[i
* 4 + 0];
3200 dst
[i
][1] = src
[i
* 4 + 1];
3201 dst
[i
][2] = src
[i
* 4 + 2];
3207 unpack_int_rgba_XBGR8888_SINT(const GLbyte
*src
, GLuint dst
[][4], GLuint n
)
3211 for (i
= 0; i
< n
; i
++) {
3212 dst
[i
][0] = src
[i
* 4 + 0];
3213 dst
[i
][1] = src
[i
* 4 + 1];
3214 dst
[i
][2] = src
[i
* 4 + 2];
3220 unpack_int_rgba_XBGR16161616_UINT(const GLushort
*src
, GLuint dst
[][4], GLuint n
)
3224 for (i
= 0; i
< n
; i
++) {
3225 dst
[i
][0] = src
[i
* 4 + 0];
3226 dst
[i
][1] = src
[i
* 4 + 1];
3227 dst
[i
][2] = src
[i
* 4 + 2];
3233 unpack_int_rgba_XBGR16161616_SINT(const GLshort
*src
, GLuint dst
[][4], GLuint n
)
3237 for (i
= 0; i
< n
; i
++) {
3238 dst
[i
][0] = src
[i
* 4 + 0];
3239 dst
[i
][1] = src
[i
* 4 + 1];
3240 dst
[i
][2] = src
[i
* 4 + 2];
3246 unpack_int_rgba_XBGR32323232_UINT(const GLuint
*src
, GLuint dst
[][4], GLuint n
)
3250 for (i
= 0; i
< n
; i
++) {
3251 dst
[i
][0] = src
[i
* 4 + 0];
3252 dst
[i
][1] = src
[i
* 4 + 1];
3253 dst
[i
][2] = src
[i
* 4 + 2];
3259 _mesa_unpack_uint_rgba_row(gl_format format
, GLuint n
,
3260 const void *src
, GLuint dst
[][4])
3263 /* Since there won't be any sign extension happening, there's no need to
3264 * make separate paths for 32-bit-to-32-bit integer unpack.
3266 case MESA_FORMAT_RGBA_UINT32
:
3267 case MESA_FORMAT_RGBA_INT32
:
3268 unpack_int_rgba_RGBA_UINT32(src
, dst
, n
);
3271 case MESA_FORMAT_RGBA_UINT16
:
3272 unpack_int_rgba_RGBA_UINT16(src
, dst
, n
);
3274 case MESA_FORMAT_RGBA_INT16
:
3275 unpack_int_rgba_RGBA_INT16(src
, dst
, n
);
3278 case MESA_FORMAT_RGBA_UINT8
:
3279 unpack_int_rgba_RGBA_UINT8(src
, dst
, n
);
3281 case MESA_FORMAT_RGBA_INT8
:
3282 unpack_int_rgba_RGBA_INT8(src
, dst
, n
);
3285 case MESA_FORMAT_ARGB8888
:
3286 unpack_int_rgba_ARGB8888(src
, dst
, n
);
3289 case MESA_FORMAT_XRGB8888
:
3290 unpack_int_rgba_XRGB8888(src
, dst
, n
);
3293 case MESA_FORMAT_RGB_UINT32
:
3294 case MESA_FORMAT_RGB_INT32
:
3295 unpack_int_rgba_RGB_UINT32(src
, dst
, n
);
3298 case MESA_FORMAT_RGB_UINT16
:
3299 unpack_int_rgba_RGB_UINT16(src
, dst
, n
);
3301 case MESA_FORMAT_RGB_INT16
:
3302 unpack_int_rgba_RGB_INT16(src
, dst
, n
);
3305 case MESA_FORMAT_RGB_UINT8
:
3306 unpack_int_rgba_RGB_UINT8(src
, dst
, n
);
3308 case MESA_FORMAT_RGB_INT8
:
3309 unpack_int_rgba_RGB_INT8(src
, dst
, n
);
3312 case MESA_FORMAT_RG_UINT32
:
3313 case MESA_FORMAT_RG_INT32
:
3314 unpack_int_rgba_RG_UINT32(src
, dst
, n
);
3317 case MESA_FORMAT_RG_UINT16
:
3318 unpack_int_rgba_RG_UINT16(src
, dst
, n
);
3320 case MESA_FORMAT_RG_INT16
:
3321 unpack_int_rgba_RG_INT16(src
, dst
, n
);
3324 case MESA_FORMAT_RG_UINT8
:
3325 unpack_int_rgba_RG_UINT8(src
, dst
, n
);
3327 case MESA_FORMAT_RG_INT8
:
3328 unpack_int_rgba_RG_INT8(src
, dst
, n
);
3331 case MESA_FORMAT_R_UINT32
:
3332 case MESA_FORMAT_R_INT32
:
3333 unpack_int_rgba_R_UINT32(src
, dst
, n
);
3336 case MESA_FORMAT_R_UINT16
:
3337 unpack_int_rgba_R_UINT16(src
, dst
, n
);
3339 case MESA_FORMAT_R_INT16
:
3340 unpack_int_rgba_R_INT16(src
, dst
, n
);
3343 case MESA_FORMAT_R_UINT8
:
3344 unpack_int_rgba_R_UINT8(src
, dst
, n
);
3346 case MESA_FORMAT_R_INT8
:
3347 unpack_int_rgba_R_INT8(src
, dst
, n
);
3350 case MESA_FORMAT_ALPHA_UINT32
:
3351 case MESA_FORMAT_ALPHA_INT32
:
3352 unpack_int_rgba_ALPHA_UINT32(src
, dst
, n
);
3355 case MESA_FORMAT_ALPHA_UINT16
:
3356 unpack_int_rgba_ALPHA_UINT16(src
, dst
, n
);
3358 case MESA_FORMAT_ALPHA_INT16
:
3359 unpack_int_rgba_ALPHA_INT16(src
, dst
, n
);
3362 case MESA_FORMAT_ALPHA_UINT8
:
3363 unpack_int_rgba_ALPHA_UINT8(src
, dst
, n
);
3365 case MESA_FORMAT_ALPHA_INT8
:
3366 unpack_int_rgba_ALPHA_INT8(src
, dst
, n
);
3369 case MESA_FORMAT_LUMINANCE_UINT32
:
3370 case MESA_FORMAT_LUMINANCE_INT32
:
3371 unpack_int_rgba_LUMINANCE_UINT32(src
, dst
, n
);
3373 case MESA_FORMAT_LUMINANCE_UINT16
:
3374 unpack_int_rgba_LUMINANCE_UINT16(src
, dst
, n
);
3376 case MESA_FORMAT_LUMINANCE_INT16
:
3377 unpack_int_rgba_LUMINANCE_INT16(src
, dst
, n
);
3380 case MESA_FORMAT_LUMINANCE_UINT8
:
3381 unpack_int_rgba_LUMINANCE_UINT8(src
, dst
, n
);
3383 case MESA_FORMAT_LUMINANCE_INT8
:
3384 unpack_int_rgba_LUMINANCE_INT8(src
, dst
, n
);
3387 case MESA_FORMAT_LUMINANCE_ALPHA_UINT32
:
3388 case MESA_FORMAT_LUMINANCE_ALPHA_INT32
:
3389 unpack_int_rgba_LUMINANCE_ALPHA_UINT32(src
, dst
, n
);
3392 case MESA_FORMAT_LUMINANCE_ALPHA_UINT16
:
3393 unpack_int_rgba_LUMINANCE_ALPHA_UINT16(src
, dst
, n
);
3395 case MESA_FORMAT_LUMINANCE_ALPHA_INT16
:
3396 unpack_int_rgba_LUMINANCE_ALPHA_INT16(src
, dst
, n
);
3399 case MESA_FORMAT_LUMINANCE_ALPHA_UINT8
:
3400 unpack_int_rgba_LUMINANCE_ALPHA_UINT8(src
, dst
, n
);
3402 case MESA_FORMAT_LUMINANCE_ALPHA_INT8
:
3403 unpack_int_rgba_LUMINANCE_ALPHA_INT8(src
, dst
, n
);
3406 case MESA_FORMAT_INTENSITY_UINT32
:
3407 case MESA_FORMAT_INTENSITY_INT32
:
3408 unpack_int_rgba_INTENSITY_UINT32(src
, dst
, n
);
3411 case MESA_FORMAT_INTENSITY_UINT16
:
3412 unpack_int_rgba_INTENSITY_UINT16(src
, dst
, n
);
3414 case MESA_FORMAT_INTENSITY_INT16
:
3415 unpack_int_rgba_INTENSITY_INT16(src
, dst
, n
);
3418 case MESA_FORMAT_INTENSITY_UINT8
:
3419 unpack_int_rgba_INTENSITY_UINT8(src
, dst
, n
);
3421 case MESA_FORMAT_INTENSITY_INT8
:
3422 unpack_int_rgba_INTENSITY_INT8(src
, dst
, n
);
3425 case MESA_FORMAT_ARGB2101010_UINT
:
3426 unpack_int_rgba_ARGB2101010_UINT(src
, dst
, n
);
3429 case MESA_FORMAT_ABGR2101010_UINT
:
3430 unpack_int_rgba_ABGR2101010_UINT(src
, dst
, n
);
3433 case MESA_FORMAT_ARGB2101010
:
3434 unpack_int_rgba_ARGB2101010(src
, dst
, n
);
3437 case MESA_FORMAT_XBGR8888_UINT
:
3438 unpack_int_rgba_XBGR8888_UINT(src
, dst
, n
);
3441 case MESA_FORMAT_XBGR8888_SINT
:
3442 unpack_int_rgba_XBGR8888_SINT(src
, dst
, n
);
3445 case MESA_FORMAT_XBGR16161616_UINT
:
3446 unpack_int_rgba_XBGR16161616_UINT(src
, dst
, n
);
3449 case MESA_FORMAT_XBGR16161616_SINT
:
3450 unpack_int_rgba_XBGR16161616_SINT(src
, dst
, n
);
3453 case MESA_FORMAT_XBGR32323232_UINT
:
3454 case MESA_FORMAT_XBGR32323232_SINT
:
3455 unpack_int_rgba_XBGR32323232_UINT(src
, dst
, n
);
3459 _mesa_problem(NULL
, "%s: bad format %s", __FUNCTION__
,
3460 _mesa_get_format_name(format
));
3466 * Unpack a 2D rect of pixels returning float RGBA colors.
3467 * \param format the source image format
3468 * \param src start address of the source image
3469 * \param srcRowStride source image row stride in bytes
3470 * \param dst start address of the dest image
3471 * \param dstRowStride dest image row stride in bytes
3472 * \param x source image start X pos
3473 * \param y source image start Y pos
3474 * \param width width of rect region to convert
3475 * \param height height of rect region to convert
3478 _mesa_unpack_rgba_block(gl_format format
,
3479 const void *src
, GLint srcRowStride
,
3480 GLfloat dst
[][4], GLint dstRowStride
,
3481 GLuint x
, GLuint y
, GLuint width
, GLuint height
)
3483 unpack_rgba_func unpack
= get_unpack_rgba_function(format
);
3484 const GLuint srcPixStride
= _mesa_get_format_bytes(format
);
3485 const GLuint dstPixStride
= 4 * sizeof(GLfloat
);
3486 const GLubyte
*srcRow
;
3490 /* XXX needs to be fixed for compressed formats */
3492 srcRow
= ((const GLubyte
*) src
) + srcRowStride
* y
+ srcPixStride
* x
;
3493 dstRow
= ((GLubyte
*) dst
) + dstRowStride
* y
+ dstPixStride
* x
;
3495 for (i
= 0; i
< height
; i
++) {
3496 unpack(srcRow
, (GLfloat (*)[4]) dstRow
, width
);
3498 dstRow
+= dstRowStride
;
3499 srcRow
+= srcRowStride
;
3506 typedef void (*unpack_float_z_func
)(GLuint n
, const void *src
, GLfloat
*dst
);
3509 unpack_float_z_Z24_X8(GLuint n
, const void *src
, GLfloat
*dst
)
3511 /* only return Z, not stencil data */
3512 const GLuint
*s
= ((const GLuint
*) src
);
3513 const GLdouble scale
= 1.0 / (GLdouble
) 0xffffff;
3515 for (i
= 0; i
< n
; i
++) {
3516 dst
[i
] = (GLfloat
) ((s
[i
] >> 8) * scale
);
3517 ASSERT(dst
[i
] >= 0.0F
);
3518 ASSERT(dst
[i
] <= 1.0F
);
3523 unpack_float_z_X8_Z24(GLuint n
, const void *src
, GLfloat
*dst
)
3525 /* only return Z, not stencil data */
3526 const GLuint
*s
= ((const GLuint
*) src
);
3527 const GLdouble scale
= 1.0 / (GLdouble
) 0xffffff;
3529 for (i
= 0; i
< n
; i
++) {
3530 dst
[i
] = (GLfloat
) ((s
[i
] & 0x00ffffff) * scale
);
3531 ASSERT(dst
[i
] >= 0.0F
);
3532 ASSERT(dst
[i
] <= 1.0F
);
3537 unpack_float_z_Z16(GLuint n
, const void *src
, GLfloat
*dst
)
3539 const GLushort
*s
= ((const GLushort
*) src
);
3541 for (i
= 0; i
< n
; i
++) {
3542 dst
[i
] = s
[i
] * (1.0F
/ 65535.0F
);
3547 unpack_float_z_Z32(GLuint n
, const void *src
, GLfloat
*dst
)
3549 const GLuint
*s
= ((const GLuint
*) src
);
3551 for (i
= 0; i
< n
; i
++) {
3552 dst
[i
] = s
[i
] * (1.0F
/ 0xffffffff);
3557 unpack_float_z_Z32F(GLuint n
, const void *src
, GLfloat
*dst
)
3559 memcpy(dst
, src
, n
* sizeof(float));
3563 unpack_float_z_Z32X24S8(GLuint n
, const void *src
, GLfloat
*dst
)
3565 const struct z32f_x24s8
*s
= (const struct z32f_x24s8
*) src
;
3567 for (i
= 0; i
< n
; i
++) {
3576 * The returned values will always be in the range [0.0, 1.0].
3579 _mesa_unpack_float_z_row(gl_format format
, GLuint n
,
3580 const void *src
, GLfloat
*dst
)
3582 unpack_float_z_func unpack
;
3585 case MESA_FORMAT_Z24_S8
:
3586 case MESA_FORMAT_Z24_X8
:
3587 unpack
= unpack_float_z_Z24_X8
;
3589 case MESA_FORMAT_S8_Z24
:
3590 case MESA_FORMAT_X8_Z24
:
3591 unpack
= unpack_float_z_X8_Z24
;
3593 case MESA_FORMAT_Z16
:
3594 unpack
= unpack_float_z_Z16
;
3596 case MESA_FORMAT_Z32
:
3597 unpack
= unpack_float_z_Z32
;
3599 case MESA_FORMAT_Z32_FLOAT
:
3600 unpack
= unpack_float_z_Z32F
;
3602 case MESA_FORMAT_Z32_FLOAT_X24S8
:
3603 unpack
= unpack_float_z_Z32X24S8
;
3606 _mesa_problem(NULL
, "bad format %s in _mesa_unpack_float_z_row",
3607 _mesa_get_format_name(format
));
3611 unpack(n
, src
, dst
);
3616 typedef void (*unpack_uint_z_func
)(const void *src
, GLuint
*dst
, GLuint n
);
3619 unpack_uint_z_Z24_X8(const void *src
, GLuint
*dst
, GLuint n
)
3621 /* only return Z, not stencil data */
3622 const GLuint
*s
= ((const GLuint
*) src
);
3624 for (i
= 0; i
< n
; i
++) {
3625 dst
[i
] = (s
[i
] & 0xffffff00) | (s
[i
] >> 24);
3630 unpack_uint_z_X8_Z24(const void *src
, GLuint
*dst
, GLuint n
)
3632 /* only return Z, not stencil data */
3633 const GLuint
*s
= ((const GLuint
*) src
);
3635 for (i
= 0; i
< n
; i
++) {
3636 dst
[i
] = (s
[i
] << 8) | ((s
[i
] >> 16) & 0xff);
3641 unpack_uint_z_Z16(const void *src
, GLuint
*dst
, GLuint n
)
3643 const GLushort
*s
= ((const GLushort
*)src
);
3645 for (i
= 0; i
< n
; i
++) {
3646 dst
[i
] = (s
[i
] << 16) | s
[i
];
3651 unpack_uint_z_Z32(const void *src
, GLuint
*dst
, GLuint n
)
3653 memcpy(dst
, src
, n
* sizeof(GLuint
));
3657 unpack_uint_z_Z32_FLOAT(const void *src
, GLuint
*dst
, GLuint n
)
3659 const float *s
= (const float *)src
;
3661 for (i
= 0; i
< n
; i
++) {
3662 dst
[i
] = FLOAT_TO_UINT(CLAMP(s
[i
], 0.0F
, 1.0F
));
3667 unpack_uint_z_Z32_FLOAT_X24S8(const void *src
, GLuint
*dst
, GLuint n
)
3669 const struct z32f_x24s8
*s
= (const struct z32f_x24s8
*) src
;
3672 for (i
= 0; i
< n
; i
++) {
3673 dst
[i
] = FLOAT_TO_UINT(CLAMP(s
[i
].z
, 0.0F
, 1.0F
));
3680 * The returned values will always be in the range [0, 0xffffffff].
3683 _mesa_unpack_uint_z_row(gl_format format
, GLuint n
,
3684 const void *src
, GLuint
*dst
)
3686 unpack_uint_z_func unpack
;
3687 const GLubyte
*srcPtr
= (GLubyte
*) src
;
3690 case MESA_FORMAT_Z24_S8
:
3691 case MESA_FORMAT_Z24_X8
:
3692 unpack
= unpack_uint_z_Z24_X8
;
3694 case MESA_FORMAT_S8_Z24
:
3695 case MESA_FORMAT_X8_Z24
:
3696 unpack
= unpack_uint_z_X8_Z24
;
3698 case MESA_FORMAT_Z16
:
3699 unpack
= unpack_uint_z_Z16
;
3701 case MESA_FORMAT_Z32
:
3702 unpack
= unpack_uint_z_Z32
;
3704 case MESA_FORMAT_Z32_FLOAT
:
3705 unpack
= unpack_uint_z_Z32_FLOAT
;
3707 case MESA_FORMAT_Z32_FLOAT_X24S8
:
3708 unpack
= unpack_uint_z_Z32_FLOAT_X24S8
;
3711 _mesa_problem(NULL
, "bad format %s in _mesa_unpack_uint_z_row",
3712 _mesa_get_format_name(format
));
3716 unpack(srcPtr
, dst
, n
);
3721 unpack_ubyte_s_S8(const void *src
, GLubyte
*dst
, GLuint n
)
3723 memcpy(dst
, src
, n
);
3727 unpack_ubyte_s_Z24_S8(const void *src
, GLubyte
*dst
, GLuint n
)
3730 const GLuint
*src32
= src
;
3732 for (i
= 0; i
< n
; i
++)
3733 dst
[i
] = src32
[i
] & 0xff;
3737 unpack_ubyte_s_S8_Z24(const void *src
, GLubyte
*dst
, GLuint n
)
3740 const GLuint
*src32
= src
;
3742 for (i
= 0; i
< n
; i
++)
3743 dst
[i
] = src32
[i
] >> 24;
3747 unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src
, GLubyte
*dst
, GLuint n
)
3750 const struct z32f_x24s8
*s
= (const struct z32f_x24s8
*) src
;
3752 for (i
= 0; i
< n
; i
++)
3753 dst
[i
] = s
[i
].x24s8
& 0xff;
3757 _mesa_unpack_ubyte_stencil_row(gl_format format
, GLuint n
,
3758 const void *src
, GLubyte
*dst
)
3761 case MESA_FORMAT_S8
:
3762 unpack_ubyte_s_S8(src
, dst
, n
);
3764 case MESA_FORMAT_Z24_S8
:
3765 unpack_ubyte_s_Z24_S8(src
, dst
, n
);
3767 case MESA_FORMAT_S8_Z24
:
3768 unpack_ubyte_s_S8_Z24(src
, dst
, n
);
3770 case MESA_FORMAT_Z32_FLOAT_X24S8
:
3771 unpack_ubyte_s_Z32_FLOAT_X24S8(src
, dst
, n
);
3774 _mesa_problem(NULL
, "bad format %s in _mesa_unpack_ubyte_s_row",
3775 _mesa_get_format_name(format
));
3781 unpack_uint_24_8_depth_stencil_S8_Z24(const GLuint
*src
, GLuint
*dst
, GLuint n
)
3785 for (i
= 0; i
< n
; i
++) {
3786 GLuint val
= src
[i
];
3787 dst
[i
] = val
>> 24 | val
<< 8;
3792 unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint
*src
, GLuint
*dst
, GLuint n
)
3794 memcpy(dst
, src
, n
* 4);
3798 _mesa_unpack_uint_24_8_depth_stencil_row(gl_format format
, GLuint n
,
3799 const void *src
, GLuint
*dst
)
3802 case MESA_FORMAT_Z24_S8
:
3803 unpack_uint_24_8_depth_stencil_Z24_S8(src
, dst
, n
);
3805 case MESA_FORMAT_S8_Z24
:
3806 unpack_uint_24_8_depth_stencil_S8_Z24(src
, dst
, n
);
3810 "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row",
3811 _mesa_get_format_name(format
));