2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 * Copyright (c) 2008 VMware, Inc.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 * \author Gareth Hughes
37 #include "texcompress.h"
38 #include "texcompress_fxt1.h"
39 #include "texcompress_s3tc.h"
40 #include "texformat.h"
44 #if FEATURE_EXT_texture_sRGB
47 * Convert an 8-bit sRGB value from non-linear space to a
48 * linear RGB value in [0, 1].
49 * Implemented with a 256-entry lookup table.
52 nonlinear_to_linear(GLubyte cs8
)
54 static GLfloat table
[256];
55 static GLboolean tableReady
= GL_FALSE
;
57 /* compute lookup table now */
59 for (i
= 0; i
< 256; i
++) {
60 const GLfloat cs
= UBYTE_TO_FLOAT(i
);
62 table
[i
] = cs
/ 12.92f
;
65 table
[i
] = (GLfloat
) _mesa_pow((cs
+ 0.055) / 1.055, 2.4);
74 #endif /* FEATURE_EXT_texture_sRGB */
77 /* Texel fetch routines for all supported formats
80 #include "texformat_tmp.h"
83 #include "texformat_tmp.h"
86 #include "texformat_tmp.h"
89 * Null texel fetch function.
91 * Have to have this so the FetchTexel function pointer is never NULL.
93 static void fetch_null_texel( const struct gl_texture_image
*texImage
,
94 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
96 (void) texImage
; (void) i
; (void) j
; (void) k
;
101 _mesa_warning(NULL
, "fetch_null_texel() called!");
104 static void fetch_null_texelf( const struct gl_texture_image
*texImage
,
105 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
107 (void) texImage
; (void) i
; (void) j
; (void) k
;
112 _mesa_warning(NULL
, "fetch_null_texelf() called!");
115 static void store_null_texel(struct gl_texture_image
*texImage
,
116 GLint i
, GLint j
, GLint k
, const void *texel
)
128 * Notes about the predefined gl_texture_formats:
130 * 1. There are 1D, 2D and 3D functions for fetching texels from texture
131 * images, returning both GLchan values and GLfloat values. (six
132 * functions in total)
133 * You don't have to provide both the GLchan and GLfloat functions;
134 * just one or the other is OK. Mesa will use an "adaptor" to convert
135 * between GLchan/GLfloat when needed.
136 * Since the adaptors have small performance penalty, we provide both
137 * GLchan and GLfloat functions for some common formats like RGB, RGBA.
141 /***************************************************************/
142 /** \name Default GLchan-based formats */
145 const struct gl_texture_format _mesa_texformat_rgba
= {
146 MESA_FORMAT_RGBA
, /* MesaFormat */
147 GL_RGBA
, /* BaseFormat */
148 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
149 CHAN_BITS
, /* RedBits */
150 CHAN_BITS
, /* GreenBits */
151 CHAN_BITS
, /* BlueBits */
152 CHAN_BITS
, /* AlphaBits */
153 0, /* LuminanceBits */
154 0, /* IntensityBits */
158 4 * sizeof(GLchan
), /* TexelBytes */
159 _mesa_texstore_rgba
, /* StoreTexImageFunc */
160 NULL
, /* FetchTexel1D */
161 NULL
, /* FetchTexel2D */
162 NULL
, /* FetchTexel3D */
163 NULL
, /* FetchTexel1Df */
164 NULL
, /* FetchTexel2Df */
165 NULL
, /* FetchTexel3Df */
166 NULL
/* StoreTexel */
169 const struct gl_texture_format _mesa_texformat_rgb
= {
170 MESA_FORMAT_RGB
, /* MesaFormat */
171 GL_RGB
, /* BaseFormat */
172 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
173 CHAN_BITS
, /* RedBits */
174 CHAN_BITS
, /* GreenBits */
175 CHAN_BITS
, /* BlueBits */
177 0, /* LuminanceBits */
178 0, /* IntensityBits */
182 3 * sizeof(GLchan
), /* TexelBytes */
183 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
184 NULL
, /* FetchTexel1D */
185 NULL
, /* FetchTexel2D */
186 NULL
, /* FetchTexel3D */
187 NULL
, /* FetchTexel1Df */
188 NULL
, /* FetchTexel2Df */
189 NULL
, /* FetchTexel3Df */
190 NULL
/* StoreTexel */
193 const struct gl_texture_format _mesa_texformat_alpha
= {
194 MESA_FORMAT_ALPHA
, /* MesaFormat */
195 GL_ALPHA
, /* BaseFormat */
196 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
200 CHAN_BITS
, /* AlphaBits */
201 0, /* LuminanceBits */
202 0, /* IntensityBits */
206 sizeof(GLchan
), /* TexelBytes */
207 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
208 NULL
, /* FetchTexel1D */
209 NULL
, /* FetchTexel2D */
210 NULL
, /* FetchTexel3D */
211 NULL
, /* FetchTexel1Df */
212 NULL
, /* FetchTexel2Df */
213 NULL
, /* FetchTexel3Df */
214 NULL
/* StoreTexel */
217 const struct gl_texture_format _mesa_texformat_luminance
= {
218 MESA_FORMAT_LUMINANCE
, /* MesaFormat */
219 GL_LUMINANCE
, /* BaseFormat */
220 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
225 CHAN_BITS
, /* LuminanceBits */
226 0, /* IntensityBits */
230 sizeof(GLchan
), /* TexelBytes */
231 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
232 NULL
, /* FetchTexel1D */
233 NULL
, /* FetchTexel2D */
234 NULL
, /* FetchTexel3D */
235 NULL
, /* FetchTexel1Df */
236 NULL
, /* FetchTexel2Df */
237 NULL
, /* FetchTexel3Df */
238 NULL
/* StoreTexel */
241 const struct gl_texture_format _mesa_texformat_luminance_alpha
= {
242 MESA_FORMAT_LUMINANCE_ALPHA
, /* MesaFormat */
243 GL_LUMINANCE_ALPHA
, /* BaseFormat */
244 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
248 CHAN_BITS
, /* AlphaBits */
249 CHAN_BITS
, /* LuminanceBits */
250 0, /* IntensityBits */
254 2 * sizeof(GLchan
), /* TexelBytes */
255 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
256 NULL
, /* FetchTexel1D */
257 NULL
, /* FetchTexel2D */
258 NULL
, /* FetchTexel3D */
259 NULL
, /* FetchTexel1Df */
260 NULL
, /* FetchTexel2Df */
261 NULL
, /* FetchTexel3Df */
262 NULL
/* StoreTexel */
265 const struct gl_texture_format _mesa_texformat_intensity
= {
266 MESA_FORMAT_INTENSITY
, /* MesaFormat */
267 GL_INTENSITY
, /* BaseFormat */
268 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
273 0, /* LuminanceBits */
274 CHAN_BITS
, /* IntensityBits */
278 sizeof(GLchan
), /* TexelBytes */
279 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
280 NULL
, /* FetchTexel1D */
281 NULL
, /* FetchTexel2D */
282 NULL
, /* FetchTexel3D */
283 NULL
, /* FetchTexel1Df */
284 NULL
, /* FetchTexel2Df */
285 NULL
, /* FetchTexel3Df */
286 NULL
/* StoreTexel */
290 #if FEATURE_EXT_texture_sRGB
292 const struct gl_texture_format _mesa_texformat_srgb8
= {
293 MESA_FORMAT_SRGB8
, /* MesaFormat */
294 GL_RGB
, /* BaseFormat */
295 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
300 0, /* LuminanceBits */
301 0, /* IntensityBits */
306 _mesa_texstore_srgb8
, /* StoreTexImageFunc */
307 NULL
, /* FetchTexel1D */
308 NULL
, /* FetchTexel2D */
309 NULL
, /* FetchTexel3D */
310 NULL
, /* FetchTexel1Df */
311 NULL
, /* FetchTexel2Df */
312 NULL
, /* FetchTexel3Df */
313 NULL
/* StoreTexel */
316 const struct gl_texture_format _mesa_texformat_srgba8
= {
317 MESA_FORMAT_SRGBA8
, /* MesaFormat */
318 GL_RGBA
, /* BaseFormat */
319 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
324 0, /* LuminanceBits */
325 0, /* IntensityBits */
330 _mesa_texstore_srgba8
, /* StoreTexImageFunc */
331 NULL
, /* FetchTexel1D */
332 NULL
, /* FetchTexel2D */
333 NULL
, /* FetchTexel3D */
334 NULL
, /* FetchTexel1Df */
335 NULL
, /* FetchTexel2Df */
336 NULL
, /* FetchTexel3Df */
337 NULL
/* StoreTexel */
340 const struct gl_texture_format _mesa_texformat_sargb8
= {
341 MESA_FORMAT_SARGB8
, /* MesaFormat */
342 GL_RGBA
, /* BaseFormat */
343 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
348 0, /* LuminanceBits */
349 0, /* IntensityBits */
354 _mesa_texstore_sargb8
, /* StoreTexImageFunc */
355 NULL
, /* FetchTexel1D */
356 NULL
, /* FetchTexel2D */
357 NULL
, /* FetchTexel3D */
358 NULL
, /* FetchTexel1Df */
359 NULL
, /* FetchTexel2Df */
360 NULL
, /* FetchTexel3Df */
361 NULL
/* StoreTexel */
364 const struct gl_texture_format _mesa_texformat_sl8
= {
365 MESA_FORMAT_SL8
, /* MesaFormat */
366 GL_LUMINANCE
, /* BaseFormat */
367 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
372 8, /* LuminanceBits */
373 0, /* IntensityBits */
378 _mesa_texstore_sl8
, /* StoreTexImageFunc */
379 NULL
, /* FetchTexel1D */
380 NULL
, /* FetchTexel2D */
381 NULL
, /* FetchTexel3D */
382 NULL
, /* FetchTexel1Df */
383 NULL
, /* FetchTexel2Df */
384 NULL
, /* FetchTexel3Df */
385 NULL
/* StoreTexel */
388 /* Note: this format name looks like a misnomer, make it sal8? */
389 const struct gl_texture_format _mesa_texformat_sla8
= {
390 MESA_FORMAT_SLA8
, /* MesaFormat */
391 GL_LUMINANCE_ALPHA
, /* BaseFormat */
392 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
397 8, /* LuminanceBits */
398 0, /* IntensityBits */
403 _mesa_texstore_sla8
, /* StoreTexImageFunc */
404 NULL
, /* FetchTexel1D */
405 NULL
, /* FetchTexel2D */
406 NULL
, /* FetchTexel3D */
407 NULL
, /* FetchTexel1Df */
408 NULL
, /* FetchTexel2Df */
409 NULL
, /* FetchTexel3Df */
410 NULL
/* StoreTexel */
413 #endif /* FEATURE_EXT_texture_sRGB */
415 const struct gl_texture_format _mesa_texformat_rgba_float32
= {
416 MESA_FORMAT_RGBA_FLOAT32
, /* MesaFormat */
417 GL_RGBA
, /* BaseFormat */
418 GL_FLOAT
, /* DataType */
419 8 * sizeof(GLfloat
), /* RedBits */
420 8 * sizeof(GLfloat
), /* GreenBits */
421 8 * sizeof(GLfloat
), /* BlueBits */
422 8 * sizeof(GLfloat
), /* AlphaBits */
423 0, /* LuminanceBits */
424 0, /* IntensityBits */
428 4 * sizeof(GLfloat
), /* TexelBytes */
429 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
430 NULL
, /* FetchTexel1D */
431 NULL
, /* FetchTexel1D */
432 NULL
, /* FetchTexel1D */
433 NULL
, /* FetchTexel1Df */
434 NULL
, /* FetchTexel1Df */
435 NULL
, /* FetchTexel1Df */
436 NULL
/* StoreTexel */
439 const struct gl_texture_format _mesa_texformat_rgba_float16
= {
440 MESA_FORMAT_RGBA_FLOAT16
, /* MesaFormat */
441 GL_RGBA
, /* BaseFormat */
442 GL_FLOAT
, /* DataType */
443 8 * sizeof(GLhalfARB
), /* RedBits */
444 8 * sizeof(GLhalfARB
), /* GreenBits */
445 8 * sizeof(GLhalfARB
), /* BlueBits */
446 8 * sizeof(GLhalfARB
), /* AlphaBits */
447 0, /* LuminanceBits */
448 0, /* IntensityBits */
452 4 * sizeof(GLhalfARB
), /* TexelBytes */
453 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
454 NULL
, /* FetchTexel1D */
455 NULL
, /* FetchTexel1D */
456 NULL
, /* FetchTexel1D */
457 NULL
, /* FetchTexel1Df */
458 NULL
, /* FetchTexel1Df */
459 NULL
, /* FetchTexel1Df */
460 NULL
/* StoreTexel */
463 const struct gl_texture_format _mesa_texformat_rgb_float32
= {
464 MESA_FORMAT_RGB_FLOAT32
, /* MesaFormat */
465 GL_RGB
, /* BaseFormat */
466 GL_FLOAT
, /* DataType */
467 8 * sizeof(GLfloat
), /* RedBits */
468 8 * sizeof(GLfloat
), /* GreenBits */
469 8 * sizeof(GLfloat
), /* BlueBits */
471 0, /* LuminanceBits */
472 0, /* IntensityBits */
476 3 * sizeof(GLfloat
), /* TexelBytes */
477 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
478 NULL
, /* FetchTexel1D */
479 NULL
, /* FetchTexel1D */
480 NULL
, /* FetchTexel1D */
481 NULL
, /* FetchTexel1Df */
482 NULL
, /* FetchTexel1Df */
483 NULL
, /* FetchTexel1Df */
484 NULL
/* StoreTexel */
487 const struct gl_texture_format _mesa_texformat_rgb_float16
= {
488 MESA_FORMAT_RGB_FLOAT16
, /* MesaFormat */
489 GL_RGB
, /* BaseFormat */
490 GL_FLOAT
, /* DataType */
491 8 * sizeof(GLhalfARB
), /* RedBits */
492 8 * sizeof(GLhalfARB
), /* GreenBits */
493 8 * sizeof(GLhalfARB
), /* BlueBits */
495 0, /* LuminanceBits */
496 0, /* IntensityBits */
500 3 * sizeof(GLhalfARB
), /* TexelBytes */
501 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
502 NULL
, /* FetchTexel1D */
503 NULL
, /* FetchTexel1D */
504 NULL
, /* FetchTexel1D */
505 NULL
, /* FetchTexel1Df */
506 NULL
, /* FetchTexel1Df */
507 NULL
, /* FetchTexel1Df */
508 NULL
/* StoreTexel */
511 const struct gl_texture_format _mesa_texformat_alpha_float32
= {
512 MESA_FORMAT_ALPHA_FLOAT32
, /* MesaFormat */
513 GL_ALPHA
, /* BaseFormat */
514 GL_FLOAT
, /* DataType */
518 8 * sizeof(GLfloat
), /* AlphaBits */
519 0, /* LuminanceBits */
520 0, /* IntensityBits */
524 1 * sizeof(GLfloat
), /* TexelBytes */
525 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
526 NULL
, /* FetchTexel1D */
527 NULL
, /* FetchTexel1D */
528 NULL
, /* FetchTexel1D */
529 NULL
, /* FetchTexel1Df */
530 NULL
, /* FetchTexel1Df */
531 NULL
, /* FetchTexel1Df */
532 NULL
/* StoreTexel */
535 const struct gl_texture_format _mesa_texformat_alpha_float16
= {
536 MESA_FORMAT_ALPHA_FLOAT16
, /* MesaFormat */
537 GL_ALPHA
, /* BaseFormat */
538 GL_FLOAT
, /* DataType */
542 8 * sizeof(GLhalfARB
), /* AlphaBits */
543 0, /* LuminanceBits */
544 0, /* IntensityBits */
548 1 * sizeof(GLhalfARB
), /* TexelBytes */
549 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
550 NULL
, /* FetchTexel1D */
551 NULL
, /* FetchTexel1D */
552 NULL
, /* FetchTexel1D */
553 NULL
, /* FetchTexel1Df */
554 NULL
, /* FetchTexel1Df */
555 NULL
, /* FetchTexel1Df */
556 NULL
/* StoreTexel */
559 const struct gl_texture_format _mesa_texformat_luminance_float32
= {
560 MESA_FORMAT_LUMINANCE_FLOAT32
, /* MesaFormat */
561 GL_LUMINANCE
, /* BaseFormat */
562 GL_FLOAT
, /* DataType */
567 8 * sizeof(GLfloat
), /* LuminanceBits */
568 0, /* IntensityBits */
572 1 * sizeof(GLfloat
), /* TexelBytes */
573 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
574 NULL
, /* FetchTexel1D */
575 NULL
, /* FetchTexel2D */
576 NULL
, /* FetchTexel3D */
577 NULL
, /* FetchTexel1Df */
578 NULL
, /* FetchTexel2Df */
579 NULL
, /* FetchTexel3Df */
580 NULL
/* StoreTexel */
583 const struct gl_texture_format _mesa_texformat_luminance_float16
= {
584 MESA_FORMAT_LUMINANCE_FLOAT16
, /* MesaFormat */
585 GL_LUMINANCE
, /* BaseFormat */
586 GL_FLOAT
, /* DataType */
591 8 * sizeof(GLhalfARB
), /* LuminanceBits */
592 0, /* IntensityBits */
596 1 * sizeof(GLhalfARB
), /* TexelBytes */
597 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
598 NULL
, /* FetchTexel1D */
599 NULL
, /* FetchTexel2D */
600 NULL
, /* FetchTexel3D */
601 NULL
, /* FetchTexel1Df */
602 NULL
, /* FetchTexel2Df */
603 NULL
, /* FetchTexel3Df */
604 NULL
/* StoreTexel */
607 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32
= {
608 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
, /* MesaFormat */
609 GL_LUMINANCE_ALPHA
, /* BaseFormat */
610 GL_FLOAT
, /* DataType */
614 8 * sizeof(GLfloat
), /* AlphaBits */
615 8 * sizeof(GLfloat
), /* LuminanceBits */
616 0, /* IntensityBits */
620 2 * sizeof(GLfloat
), /* TexelBytes */
621 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
622 NULL
, /* FetchTexel1D */
623 NULL
, /* FetchTexel2D */
624 NULL
, /* FetchTexel3D */
625 NULL
, /* FetchTexel1Df */
626 NULL
, /* FetchTexel2Df */
627 NULL
, /* FetchTexel3Df */
628 NULL
/* StoreTexel */
631 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16
= {
632 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
, /* MesaFormat */
633 GL_LUMINANCE_ALPHA
, /* BaseFormat */
634 GL_FLOAT
, /* DataType */
638 8 * sizeof(GLhalfARB
), /* AlphaBits */
639 8 * sizeof(GLhalfARB
), /* LuminanceBits */
640 0, /* IntensityBits */
644 2 * sizeof(GLhalfARB
), /* TexelBytes */
645 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
646 NULL
, /* FetchTexel1D */
647 NULL
, /* FetchTexel2D */
648 NULL
, /* FetchTexel3D */
649 NULL
, /* FetchTexel1Df */
650 NULL
, /* FetchTexel2Df */
651 NULL
, /* FetchTexel3Df */
652 NULL
/* StoreTexel */
655 const struct gl_texture_format _mesa_texformat_intensity_float32
= {
656 MESA_FORMAT_INTENSITY_FLOAT32
, /* MesaFormat */
657 GL_INTENSITY
, /* BaseFormat */
658 GL_FLOAT
, /* DataType */
663 0, /* LuminanceBits */
664 8 * sizeof(GLfloat
), /* IntensityBits */
668 1 * sizeof(GLfloat
), /* TexelBytes */
669 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
670 NULL
, /* FetchTexel1D */
671 NULL
, /* FetchTexel2D */
672 NULL
, /* FetchTexel3D */
673 NULL
, /* FetchTexel1Df */
674 NULL
, /* FetchTexel2Df */
675 NULL
, /* FetchTexel3Df */
676 NULL
/* StoreTexel */
679 const struct gl_texture_format _mesa_texformat_intensity_float16
= {
680 MESA_FORMAT_INTENSITY_FLOAT16
, /* MesaFormat */
681 GL_INTENSITY
, /* BaseFormat */
682 GL_FLOAT
, /* DataType */
687 0, /* LuminanceBits */
688 8 * sizeof(GLhalfARB
), /* IntensityBits */
692 1 * sizeof(GLhalfARB
), /* TexelBytes */
693 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
694 NULL
, /* FetchTexel1D */
695 NULL
, /* FetchTexel2D */
696 NULL
, /* FetchTexel3D */
697 NULL
, /* FetchTexel1Df */
698 NULL
, /* FetchTexel2Df */
699 NULL
, /* FetchTexel3Df */
700 NULL
/* StoreTexel */
703 const struct gl_texture_format _mesa_texformat_dudv8
= {
704 MESA_FORMAT_DUDV8
, /* MesaFormat */
705 GL_DUDV_ATI
, /* BaseFormat */
706 GL_SIGNED_NORMALIZED
, /* DataType */
707 /* maybe should add dudvBits field, but spec seems to be
708 lacking the ability to query with GetTexLevelParameter anyway */
713 0, /* LuminanceBits */
714 0, /* IntensityBits */
719 _mesa_texstore_dudv8
, /* StoreTexImageFunc */
720 NULL
, /* FetchTexel1D */
721 NULL
, /* FetchTexel2D */
722 NULL
, /* FetchTexel3D */
723 NULL
, /* FetchTexel1Df */
724 NULL
, /* FetchTexel2Df */
725 NULL
, /* FetchTexel3Df */
726 NULL
/* StoreTexel */
729 const struct gl_texture_format _mesa_texformat_signed_rgba8888
= {
730 MESA_FORMAT_SIGNED_RGBA8888
, /* MesaFormat */
731 GL_RGBA
, /* BaseFormat */
732 GL_SIGNED_NORMALIZED
, /* DataType */
737 0, /* LuminanceBits */
738 0, /* IntensityBits */
743 _mesa_texstore_signed_rgba8888
, /* StoreTexImageFunc */
744 NULL
, /* FetchTexel1D */
745 NULL
, /* FetchTexel2D */
746 NULL
, /* FetchTexel3D */
747 NULL
, /* FetchTexel1Df */
748 NULL
, /* FetchTexel2Df */
749 NULL
, /* FetchTexel3Df */
750 NULL
/* StoreTexel */
753 const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev
= {
754 MESA_FORMAT_SIGNED_RGBA8888_REV
, /* MesaFormat */
755 GL_RGBA
, /* BaseFormat */
756 GL_SIGNED_NORMALIZED
, /* DataType */
761 0, /* LuminanceBits */
762 0, /* IntensityBits */
767 _mesa_texstore_signed_rgba8888
, /* StoreTexImageFunc */
768 NULL
, /* FetchTexel1D */
769 NULL
, /* FetchTexel2D */
770 NULL
, /* FetchTexel3D */
771 NULL
, /* FetchTexel1Df */
772 NULL
, /* FetchTexel2Df */
773 NULL
, /* FetchTexel3Df */
774 NULL
/* StoreTexel */
780 /***************************************************************/
781 /** \name Hardware formats */
784 const struct gl_texture_format _mesa_texformat_rgba8888
= {
785 MESA_FORMAT_RGBA8888
, /* MesaFormat */
786 GL_RGBA
, /* BaseFormat */
787 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
792 0, /* LuminanceBits */
793 0, /* IntensityBits */
798 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
799 NULL
, /* FetchTexel1D */
800 NULL
, /* FetchTexel2D */
801 NULL
, /* FetchTexel3D */
802 NULL
, /* FetchTexel1Df */
803 NULL
, /* FetchTexel2Df */
804 NULL
, /* FetchTexel3Df */
805 NULL
/* StoreTexel */
808 const struct gl_texture_format _mesa_texformat_rgba8888_rev
= {
809 MESA_FORMAT_RGBA8888_REV
, /* MesaFormat */
810 GL_RGBA
, /* BaseFormat */
811 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
816 0, /* LuminanceBits */
817 0, /* IntensityBits */
822 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
823 NULL
, /* FetchTexel1D */
824 NULL
, /* FetchTexel2D */
825 NULL
, /* FetchTexel3D */
826 NULL
, /* FetchTexel1Df */
827 NULL
, /* FetchTexel2Df */
828 NULL
, /* FetchTexel3Df */
829 NULL
/* StoreTexel */
832 const struct gl_texture_format _mesa_texformat_argb8888
= {
833 MESA_FORMAT_ARGB8888
, /* MesaFormat */
834 GL_RGBA
, /* BaseFormat */
835 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
840 0, /* LuminanceBits */
841 0, /* IntensityBits */
846 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
847 NULL
, /* FetchTexel1D */
848 NULL
, /* FetchTexel2D */
849 NULL
, /* FetchTexel3D */
850 NULL
, /* FetchTexel1Df */
851 NULL
, /* FetchTexel2Df */
852 NULL
, /* FetchTexel3Df */
853 NULL
/* StoreTexel */
856 const struct gl_texture_format _mesa_texformat_argb8888_rev
= {
857 MESA_FORMAT_ARGB8888_REV
, /* MesaFormat */
858 GL_RGBA
, /* BaseFormat */
859 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
864 0, /* LuminanceBits */
865 0, /* IntensityBits */
870 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
871 NULL
, /* FetchTexel1D */
872 NULL
, /* FetchTexel2D */
873 NULL
, /* FetchTexel3D */
874 NULL
, /* FetchTexel1Df */
875 NULL
, /* FetchTexel2Df */
876 NULL
, /* FetchTexel3Df */
877 NULL
/* StoreTexel */
880 const struct gl_texture_format _mesa_texformat_rgb888
= {
881 MESA_FORMAT_RGB888
, /* MesaFormat */
882 GL_RGB
, /* BaseFormat */
883 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
888 0, /* LuminanceBits */
889 0, /* IntensityBits */
894 _mesa_texstore_rgb888
, /* StoreTexImageFunc */
895 NULL
, /* FetchTexel1D */
896 NULL
, /* FetchTexel2D */
897 NULL
, /* FetchTexel3D */
898 NULL
, /* FetchTexel1Df */
899 NULL
, /* FetchTexel2Df */
900 NULL
, /* FetchTexel3Df */
901 NULL
/* StoreTexel */
904 const struct gl_texture_format _mesa_texformat_bgr888
= {
905 MESA_FORMAT_BGR888
, /* MesaFormat */
906 GL_RGB
, /* BaseFormat */
907 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
912 0, /* LuminanceBits */
913 0, /* IntensityBits */
918 _mesa_texstore_bgr888
, /* StoreTexImageFunc */
919 NULL
, /* FetchTexel1D */
920 NULL
, /* FetchTexel2D */
921 NULL
, /* FetchTexel3D */
922 NULL
, /* FetchTexel1Df */
923 NULL
, /* FetchTexel2Df */
924 NULL
, /* FetchTexel3Df */
925 NULL
/* StoreTexel */
928 const struct gl_texture_format _mesa_texformat_rgb565
= {
929 MESA_FORMAT_RGB565
, /* MesaFormat */
930 GL_RGB
, /* BaseFormat */
931 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
936 0, /* LuminanceBits */
937 0, /* IntensityBits */
942 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
943 NULL
, /* FetchTexel1D */
944 NULL
, /* FetchTexel2D */
945 NULL
, /* FetchTexel3D */
946 NULL
, /* FetchTexel1Df */
947 NULL
, /* FetchTexel2Df */
948 NULL
, /* FetchTexel3Df */
949 NULL
/* StoreTexel */
952 const struct gl_texture_format _mesa_texformat_rgb565_rev
= {
953 MESA_FORMAT_RGB565_REV
, /* MesaFormat */
954 GL_RGB
, /* BaseFormat */
955 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
960 0, /* LuminanceBits */
961 0, /* IntensityBits */
966 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
967 NULL
, /* FetchTexel1D */
968 NULL
, /* FetchTexel2D */
969 NULL
, /* FetchTexel3D */
970 NULL
, /* FetchTexel1Df */
971 NULL
, /* FetchTexel2Df */
972 NULL
, /* FetchTexel3Df */
973 NULL
/* StoreTexel */
976 const struct gl_texture_format _mesa_texformat_rgba4444
= {
977 MESA_FORMAT_RGBA4444
, /* MesaFormat */
978 GL_RGBA
, /* BaseFormat */
979 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
984 0, /* LuminanceBits */
985 0, /* IntensityBits */
990 _mesa_texstore_rgba4444
, /* StoreTexImageFunc */
991 NULL
, /* FetchTexel1D */
992 NULL
, /* FetchTexel2D */
993 NULL
, /* FetchTexel3D */
994 NULL
, /* FetchTexel1Df */
995 NULL
, /* FetchTexel2Df */
996 NULL
, /* FetchTexel3Df */
997 NULL
/* StoreTexel */
1000 const struct gl_texture_format _mesa_texformat_argb4444
= {
1001 MESA_FORMAT_ARGB4444
, /* MesaFormat */
1002 GL_RGBA
, /* BaseFormat */
1003 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1008 0, /* LuminanceBits */
1009 0, /* IntensityBits */
1012 0, /* StencilBits */
1014 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
1015 NULL
, /* FetchTexel1D */
1016 NULL
, /* FetchTexel2D */
1017 NULL
, /* FetchTexel3D */
1018 NULL
, /* FetchTexel1Df */
1019 NULL
, /* FetchTexel2Df */
1020 NULL
, /* FetchTexel3Df */
1021 NULL
/* StoreTexel */
1024 const struct gl_texture_format _mesa_texformat_argb4444_rev
= {
1025 MESA_FORMAT_ARGB4444_REV
, /* MesaFormat */
1026 GL_RGBA
, /* BaseFormat */
1027 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1032 0, /* LuminanceBits */
1033 0, /* IntensityBits */
1036 0, /* StencilBits */
1038 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
1039 NULL
, /* FetchTexel1D */
1040 NULL
, /* FetchTexel2D */
1041 NULL
, /* FetchTexel3D */
1042 NULL
, /* FetchTexel1Df */
1043 NULL
, /* FetchTexel2Df */
1044 NULL
, /* FetchTexel3Df */
1045 NULL
/* StoreTexel */
1048 const struct gl_texture_format _mesa_texformat_rgba5551
= {
1049 MESA_FORMAT_RGBA5551
, /* MesaFormat */
1050 GL_RGBA
, /* BaseFormat */
1051 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1056 0, /* LuminanceBits */
1057 0, /* IntensityBits */
1060 0, /* StencilBits */
1062 _mesa_texstore_rgba5551
, /* StoreTexImageFunc */
1063 NULL
, /* FetchTexel1D */
1064 NULL
, /* FetchTexel2D */
1065 NULL
, /* FetchTexel3D */
1066 NULL
, /* FetchTexel1Df */
1067 NULL
, /* FetchTexel2Df */
1068 NULL
, /* FetchTexel3Df */
1069 NULL
/* StoreTexel */
1072 const struct gl_texture_format _mesa_texformat_argb1555
= {
1073 MESA_FORMAT_ARGB1555
, /* MesaFormat */
1074 GL_RGBA
, /* BaseFormat */
1075 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1080 0, /* LuminanceBits */
1081 0, /* IntensityBits */
1084 0, /* StencilBits */
1086 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
1087 NULL
, /* FetchTexel1D */
1088 NULL
, /* FetchTexel2D */
1089 NULL
, /* FetchTexel3D */
1090 NULL
, /* FetchTexel1Df */
1091 NULL
, /* FetchTexel2Df */
1092 NULL
, /* FetchTexel3Df */
1093 NULL
/* StoreTexel */
1096 const struct gl_texture_format _mesa_texformat_argb1555_rev
= {
1097 MESA_FORMAT_ARGB1555_REV
, /* MesaFormat */
1098 GL_RGBA
, /* BaseFormat */
1099 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1104 0, /* LuminanceBits */
1105 0, /* IntensityBits */
1108 0, /* StencilBits */
1110 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
1111 NULL
, /* FetchTexel1D */
1112 NULL
, /* FetchTexel2D */
1113 NULL
, /* FetchTexel3D */
1114 NULL
, /* FetchTexel1Df */
1115 NULL
, /* FetchTexel2Df */
1116 NULL
, /* FetchTexel3Df */
1117 NULL
/* StoreTexel */
1120 const struct gl_texture_format _mesa_texformat_al88
= {
1121 MESA_FORMAT_AL88
, /* MesaFormat */
1122 GL_LUMINANCE_ALPHA
, /* BaseFormat */
1123 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1128 8, /* LuminanceBits */
1129 0, /* IntensityBits */
1132 0, /* StencilBits */
1134 _mesa_texstore_al88
, /* StoreTexImageFunc */
1135 NULL
, /* FetchTexel1D */
1136 NULL
, /* FetchTexel2D */
1137 NULL
, /* FetchTexel3D */
1138 NULL
, /* FetchTexel1Df */
1139 NULL
, /* FetchTexel2Df */
1140 NULL
, /* FetchTexel3Df */
1141 NULL
/* StoreTexel */
1144 const struct gl_texture_format _mesa_texformat_al88_rev
= {
1145 MESA_FORMAT_AL88_REV
, /* MesaFormat */
1146 GL_LUMINANCE_ALPHA
, /* BaseFormat */
1147 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1152 8, /* LuminanceBits */
1153 0, /* IntensityBits */
1156 0, /* StencilBits */
1158 _mesa_texstore_al88
, /* StoreTexImageFunc */
1159 NULL
, /* FetchTexel1D */
1160 NULL
, /* FetchTexel2D */
1161 NULL
, /* FetchTexel3D */
1162 NULL
, /* FetchTexel1Df */
1163 NULL
, /* FetchTexel2Df */
1164 NULL
, /* FetchTexel3Df */
1165 NULL
/* StoreTexel */
1168 const struct gl_texture_format _mesa_texformat_rgb332
= {
1169 MESA_FORMAT_RGB332
, /* MesaFormat */
1170 GL_RGB
, /* BaseFormat */
1171 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1176 0, /* LuminanceBits */
1177 0, /* IntensityBits */
1180 0, /* StencilBits */
1182 _mesa_texstore_rgb332
, /* StoreTexImageFunc */
1183 NULL
, /* FetchTexel1D */
1184 NULL
, /* FetchTexel2D */
1185 NULL
, /* FetchTexel3D */
1186 NULL
, /* FetchTexel1Df */
1187 NULL
, /* FetchTexel2Df */
1188 NULL
, /* FetchTexel3Df */
1189 NULL
/* StoreTexel */
1192 const struct gl_texture_format _mesa_texformat_a8
= {
1193 MESA_FORMAT_A8
, /* MesaFormat */
1194 GL_ALPHA
, /* BaseFormat */
1195 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1200 0, /* LuminanceBits */
1201 0, /* IntensityBits */
1204 0, /* StencilBits */
1206 _mesa_texstore_a8
, /* StoreTexImageFunc */
1207 NULL
, /* FetchTexel1D */
1208 NULL
, /* FetchTexel2D */
1209 NULL
, /* FetchTexel3D */
1210 NULL
, /* FetchTexel1Df */
1211 NULL
, /* FetchTexel2Df */
1212 NULL
, /* FetchTexel3Df */
1213 NULL
/* StoreTexel */
1216 const struct gl_texture_format _mesa_texformat_l8
= {
1217 MESA_FORMAT_L8
, /* MesaFormat */
1218 GL_LUMINANCE
, /* BaseFormat */
1219 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1224 8, /* LuminanceBits */
1225 0, /* IntensityBits */
1228 0, /* StencilBits */
1230 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
1231 NULL
, /* FetchTexel1D */
1232 NULL
, /* FetchTexel2D */
1233 NULL
, /* FetchTexel3D */
1234 NULL
, /* FetchTexel1Df */
1235 NULL
, /* FetchTexel2Df */
1236 NULL
, /* FetchTexel3Df */
1237 NULL
/* StoreTexel */
1240 const struct gl_texture_format _mesa_texformat_i8
= {
1241 MESA_FORMAT_I8
, /* MesaFormat */
1242 GL_INTENSITY
, /* BaseFormat */
1243 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1248 0, /* LuminanceBits */
1249 8, /* IntensityBits */
1252 0, /* StencilBits */
1254 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
1255 NULL
, /* FetchTexel1D */
1256 NULL
, /* FetchTexel2D */
1257 NULL
, /* FetchTexel3D */
1258 NULL
, /* FetchTexel1Df */
1259 NULL
, /* FetchTexel2Df */
1260 NULL
, /* FetchTexel3Df */
1261 NULL
/* StoreTexel */
1264 const struct gl_texture_format _mesa_texformat_ci8
= {
1265 MESA_FORMAT_CI8
, /* MesaFormat */
1266 GL_COLOR_INDEX
, /* BaseFormat */
1267 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1272 0, /* LuminanceBits */
1273 0, /* IntensityBits */
1276 0, /* StencilBits */
1278 _mesa_texstore_ci8
, /* StoreTexImageFunc */
1279 NULL
, /* FetchTexel1D */
1280 NULL
, /* FetchTexel2D */
1281 NULL
, /* FetchTexel3D */
1282 NULL
, /* FetchTexel1Df */
1283 NULL
, /* FetchTexel2Df */
1284 NULL
, /* FetchTexel3Df */
1285 NULL
/* StoreTexel */
1288 const struct gl_texture_format _mesa_texformat_ycbcr
= {
1289 MESA_FORMAT_YCBCR
, /* MesaFormat */
1290 GL_YCBCR_MESA
, /* BaseFormat */
1291 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1296 0, /* LuminanceBits */
1297 0, /* IntensityBits */
1300 0, /* StencilBits */
1302 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1303 NULL
, /* FetchTexel1D */
1304 NULL
, /* FetchTexel2D */
1305 NULL
, /* FetchTexel3D */
1306 NULL
, /* FetchTexel1Df */
1307 NULL
, /* FetchTexel2Df */
1308 NULL
, /* FetchTexel3Df */
1309 NULL
/* StoreTexel */
1312 const struct gl_texture_format _mesa_texformat_ycbcr_rev
= {
1313 MESA_FORMAT_YCBCR_REV
, /* MesaFormat */
1314 GL_YCBCR_MESA
, /* BaseFormat */
1315 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1320 0, /* LuminanceBits */
1321 0, /* IntensityBits */
1324 0, /* StencilBits */
1326 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1327 NULL
, /* FetchTexel1D */
1328 NULL
, /* FetchTexel2D */
1329 NULL
, /* FetchTexel3D */
1330 NULL
, /* FetchTexel1Df */
1331 NULL
, /* FetchTexel2Df */
1332 NULL
, /* FetchTexel3Df */
1333 NULL
/* StoreTexel */
1336 const struct gl_texture_format _mesa_texformat_z24_s8
= {
1337 MESA_FORMAT_Z24_S8
, /* MesaFormat */
1338 GL_DEPTH_STENCIL_EXT
, /* BaseFormat */
1339 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1344 0, /* LuminanceBits */
1345 0, /* IntensityBits */
1348 8, /* StencilBits */
1350 _mesa_texstore_z24_s8
, /* StoreTexImageFunc */
1351 NULL
, /* FetchTexel1D */
1352 NULL
, /* FetchTexel2D */
1353 NULL
, /* FetchTexel3D */
1354 NULL
, /* FetchTexel1Df */
1355 NULL
, /* FetchTexel2Df */
1356 NULL
, /* FetchTexel3Df */
1357 NULL
/* StoreTexel */
1360 const struct gl_texture_format _mesa_texformat_s8_z24
= {
1361 MESA_FORMAT_S8_Z24
, /* MesaFormat */
1362 GL_DEPTH_STENCIL_EXT
, /* BaseFormat */
1363 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1368 0, /* LuminanceBits */
1369 0, /* IntensityBits */
1372 8, /* StencilBits */
1374 _mesa_texstore_s8_z24
, /* StoreTexImageFunc */
1375 NULL
, /* FetchTexel1D */
1376 NULL
, /* FetchTexel2D */
1377 NULL
, /* FetchTexel3D */
1378 NULL
, /* FetchTexel1Df */
1379 NULL
, /* FetchTexel2Df */
1380 NULL
, /* FetchTexel3Df */
1381 NULL
/* StoreTexel */
1384 const struct gl_texture_format _mesa_texformat_z16
= {
1385 MESA_FORMAT_Z16
, /* MesaFormat */
1386 GL_DEPTH_COMPONENT
, /* BaseFormat */
1387 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1392 0, /* LuminanceBits */
1393 0, /* IntensityBits */
1395 sizeof(GLushort
) * 8, /* DepthBits */
1396 0, /* StencilBits */
1397 sizeof(GLushort
), /* TexelBytes */
1398 _mesa_texstore_z16
, /* StoreTexImageFunc */
1399 NULL
, /* FetchTexel1D */
1400 NULL
, /* FetchTexel1D */
1401 NULL
, /* FetchTexel1D */
1402 NULL
, /* FetchTexel1Df */
1403 NULL
, /* FetchTexel1Df */
1404 NULL
, /* FetchTexel1Df */
1405 NULL
/* StoreTexel */
1408 const struct gl_texture_format _mesa_texformat_z32
= {
1409 MESA_FORMAT_Z32
, /* MesaFormat */
1410 GL_DEPTH_COMPONENT
, /* BaseFormat */
1411 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1416 0, /* LuminanceBits */
1417 0, /* IntensityBits */
1419 sizeof(GLuint
) * 8, /* DepthBits */
1420 0, /* StencilBits */
1421 sizeof(GLuint
), /* TexelBytes */
1422 _mesa_texstore_z32
, /* StoreTexImageFunc */
1423 NULL
, /* FetchTexel1D */
1424 NULL
, /* FetchTexel1D */
1425 NULL
, /* FetchTexel1D */
1426 NULL
, /* FetchTexel1Df */
1427 NULL
, /* FetchTexel1Df */
1428 NULL
, /* FetchTexel1Df */
1429 NULL
/* StoreTexel */
1435 /***************************************************************/
1436 /** \name Null format (useful for proxy textures) */
1439 const struct gl_texture_format _mesa_null_texformat
= {
1440 -1, /* MesaFormat */
1442 GL_NONE
, /* DataType */
1447 0, /* LuminanceBits */
1448 0, /* IntensityBits */
1451 0, /* StencilBits */
1453 NULL
, /* StoreTexImageFunc */
1454 fetch_null_texel
, /* FetchTexel1D */
1455 fetch_null_texel
, /* FetchTexel1D */
1456 fetch_null_texel
, /* FetchTexel1D */
1457 fetch_null_texelf
, /* FetchTexel1Df */
1458 fetch_null_texelf
, /* FetchTexel1Df */
1459 fetch_null_texelf
, /* FetchTexel1Df */
1460 store_null_texel
/* StoreTexel */
1467 * Choose an appropriate texture format given the format, type and
1468 * internalFormat parameters passed to glTexImage().
1470 * \param ctx the GL context.
1471 * \param internalFormat user's prefered internal texture format.
1472 * \param format incoming image pixel format.
1473 * \param type incoming image data type.
1475 * \return a pointer to a gl_texture_format object which describes the
1476 * choosen texture format, or NULL on failure.
1478 * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
1479 * will typically override this function with a specialized version.
1481 const struct gl_texture_format
*
1482 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
1483 GLenum format
, GLenum type
)
1488 switch (internalFormat
) {
1495 return &_mesa_texformat_rgba
;
1497 return &_mesa_texformat_rgba8888
;
1499 return &_mesa_texformat_argb1555
;
1501 return &_mesa_texformat_argb4444_rev
; /* just to test another format*/
1503 return &_mesa_texformat_argb4444
;
1511 return &_mesa_texformat_rgb
;
1513 return &_mesa_texformat_rgb888
;
1515 return &_mesa_texformat_rgb332
;
1517 return &_mesa_texformat_rgb565_rev
; /* just to test another format */
1519 return &_mesa_texformat_rgb565
;
1526 return &_mesa_texformat_alpha
;
1528 return &_mesa_texformat_a8
;
1530 /* Luminance formats */
1534 case GL_LUMINANCE12
:
1535 case GL_LUMINANCE16
:
1536 return &_mesa_texformat_luminance
;
1538 return &_mesa_texformat_l8
;
1540 /* Luminance/Alpha formats */
1542 case GL_LUMINANCE_ALPHA
:
1543 case GL_LUMINANCE4_ALPHA4
:
1544 case GL_LUMINANCE6_ALPHA2
:
1545 case GL_LUMINANCE12_ALPHA4
:
1546 case GL_LUMINANCE12_ALPHA12
:
1547 case GL_LUMINANCE16_ALPHA16
:
1548 return &_mesa_texformat_luminance_alpha
;
1549 case GL_LUMINANCE8_ALPHA8
:
1550 return &_mesa_texformat_al88
;
1554 case GL_INTENSITY12
:
1555 case GL_INTENSITY16
:
1556 return &_mesa_texformat_intensity
;
1558 return &_mesa_texformat_i8
;
1560 case GL_COLOR_INDEX
:
1561 case GL_COLOR_INDEX1_EXT
:
1562 case GL_COLOR_INDEX2_EXT
:
1563 case GL_COLOR_INDEX4_EXT
:
1564 case GL_COLOR_INDEX12_EXT
:
1565 case GL_COLOR_INDEX16_EXT
:
1566 case GL_COLOR_INDEX8_EXT
:
1567 return &_mesa_texformat_ci8
;
1573 if (ctx
->Extensions
.ARB_depth_texture
) {
1574 switch (internalFormat
) {
1575 case GL_DEPTH_COMPONENT
:
1576 case GL_DEPTH_COMPONENT24
:
1577 case GL_DEPTH_COMPONENT32
:
1578 return &_mesa_texformat_z32
;
1579 case GL_DEPTH_COMPONENT16
:
1580 return &_mesa_texformat_z16
;
1586 switch (internalFormat
) {
1587 case GL_COMPRESSED_ALPHA_ARB
:
1588 return &_mesa_texformat_alpha
;
1589 case GL_COMPRESSED_LUMINANCE_ARB
:
1590 return &_mesa_texformat_luminance
;
1591 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
1592 return &_mesa_texformat_luminance_alpha
;
1593 case GL_COMPRESSED_INTENSITY_ARB
:
1594 return &_mesa_texformat_intensity
;
1595 case GL_COMPRESSED_RGB_ARB
:
1596 #if FEATURE_texture_fxt1
1597 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1598 return &_mesa_texformat_rgb_fxt1
;
1600 #if FEATURE_texture_s3tc
1601 if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1602 ctx
->Extensions
.S3_s3tc
)
1603 return &_mesa_texformat_rgb_dxt1
;
1605 return &_mesa_texformat_rgb
;
1606 case GL_COMPRESSED_RGBA_ARB
:
1607 #if FEATURE_texture_fxt1
1608 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1609 return &_mesa_texformat_rgba_fxt1
;
1611 #if FEATURE_texture_s3tc
1612 if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1613 ctx
->Extensions
.S3_s3tc
)
1614 return &_mesa_texformat_rgba_dxt3
; /* Not rgba_dxt1, see spec */
1616 return &_mesa_texformat_rgba
;
1621 if (ctx
->Extensions
.MESA_ycbcr_texture
) {
1622 if (internalFormat
== GL_YCBCR_MESA
) {
1623 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
)
1624 return &_mesa_texformat_ycbcr
;
1626 return &_mesa_texformat_ycbcr_rev
;
1630 #if FEATURE_texture_fxt1
1631 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
) {
1632 switch (internalFormat
) {
1633 case GL_COMPRESSED_RGB_FXT1_3DFX
:
1634 return &_mesa_texformat_rgb_fxt1
;
1635 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
1636 return &_mesa_texformat_rgba_fxt1
;
1643 #if FEATURE_texture_s3tc
1644 if (ctx
->Extensions
.EXT_texture_compression_s3tc
) {
1645 switch (internalFormat
) {
1646 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
1647 return &_mesa_texformat_rgb_dxt1
;
1648 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
1649 return &_mesa_texformat_rgba_dxt1
;
1650 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
1651 return &_mesa_texformat_rgba_dxt3
;
1652 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
1653 return &_mesa_texformat_rgba_dxt5
;
1659 if (ctx
->Extensions
.S3_s3tc
) {
1660 switch (internalFormat
) {
1663 return &_mesa_texformat_rgb_dxt1
;
1666 return &_mesa_texformat_rgba_dxt3
;
1673 if (ctx
->Extensions
.ARB_texture_float
) {
1674 switch (internalFormat
) {
1675 case GL_ALPHA16F_ARB
:
1676 return &_mesa_texformat_alpha_float16
;
1677 case GL_ALPHA32F_ARB
:
1678 return &_mesa_texformat_alpha_float32
;
1679 case GL_LUMINANCE16F_ARB
:
1680 return &_mesa_texformat_luminance_float16
;
1681 case GL_LUMINANCE32F_ARB
:
1682 return &_mesa_texformat_luminance_float32
;
1683 case GL_LUMINANCE_ALPHA16F_ARB
:
1684 return &_mesa_texformat_luminance_alpha_float16
;
1685 case GL_LUMINANCE_ALPHA32F_ARB
:
1686 return &_mesa_texformat_luminance_alpha_float32
;
1687 case GL_INTENSITY16F_ARB
:
1688 return &_mesa_texformat_intensity_float16
;
1689 case GL_INTENSITY32F_ARB
:
1690 return &_mesa_texformat_intensity_float32
;
1692 return &_mesa_texformat_rgb_float16
;
1694 return &_mesa_texformat_rgb_float32
;
1695 case GL_RGBA16F_ARB
:
1696 return &_mesa_texformat_rgba_float16
;
1697 case GL_RGBA32F_ARB
:
1698 return &_mesa_texformat_rgba_float32
;
1704 if (ctx
->Extensions
.EXT_packed_depth_stencil
) {
1705 switch (internalFormat
) {
1706 case GL_DEPTH_STENCIL_EXT
:
1707 case GL_DEPTH24_STENCIL8_EXT
:
1708 return &_mesa_texformat_z24_s8
;
1714 if (ctx
->Extensions
.ATI_envmap_bumpmap
) {
1715 switch (internalFormat
) {
1718 return &_mesa_texformat_dudv8
;
1724 if (ctx
->Extensions
.MESA_texture_signed_rgba
) {
1725 switch (internalFormat
) {
1727 case GL_RGBA8_SNORM
:
1728 return &_mesa_texformat_signed_rgba8888
;
1735 #if FEATURE_EXT_texture_sRGB
1736 if (ctx
->Extensions
.EXT_texture_sRGB
) {
1737 switch (internalFormat
) {
1740 return &_mesa_texformat_srgb8
;
1741 case GL_SRGB_ALPHA_EXT
:
1742 case GL_SRGB8_ALPHA8_EXT
:
1743 return &_mesa_texformat_srgba8
;
1744 case GL_SLUMINANCE_EXT
:
1745 case GL_SLUMINANCE8_EXT
:
1746 return &_mesa_texformat_sl8
;
1747 case GL_SLUMINANCE_ALPHA_EXT
:
1748 case GL_SLUMINANCE8_ALPHA8_EXT
:
1749 return &_mesa_texformat_sla8
;
1750 case GL_COMPRESSED_SLUMINANCE_EXT
:
1751 return &_mesa_texformat_sl8
;
1752 case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT
:
1753 return &_mesa_texformat_sla8
;
1754 case GL_COMPRESSED_SRGB_EXT
:
1755 #if FEATURE_texture_s3tc
1756 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1757 return &_mesa_texformat_srgb_dxt1
;
1759 return &_mesa_texformat_srgb8
;
1760 case GL_COMPRESSED_SRGB_ALPHA_EXT
:
1761 #if FEATURE_texture_s3tc
1762 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1763 return &_mesa_texformat_srgba_dxt3
; /* Not srgba_dxt1, see spec */
1765 return &_mesa_texformat_srgba8
;
1766 #if FEATURE_texture_s3tc
1767 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
:
1768 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1769 return &_mesa_texformat_srgb_dxt1
;
1771 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
:
1772 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1773 return &_mesa_texformat_srgba_dxt1
;
1775 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
:
1776 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1777 return &_mesa_texformat_srgba_dxt3
;
1779 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
:
1780 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
1781 return &_mesa_texformat_srgba_dxt5
;
1788 #endif /* FEATURE_EXT_texture_sRGB */
1790 _mesa_problem(ctx
, "unexpected format in _mesa_choose_tex_format()");
1797 * Return datatype and number of components per texel for the
1798 * given gl_texture_format.
1801 _mesa_format_to_type_and_comps(const struct gl_texture_format
*format
,
1802 GLenum
*datatype
, GLuint
*comps
)
1804 switch (format
->MesaFormat
) {
1805 case MESA_FORMAT_RGBA8888
:
1806 case MESA_FORMAT_RGBA8888_REV
:
1807 case MESA_FORMAT_ARGB8888
:
1808 case MESA_FORMAT_ARGB8888_REV
:
1809 *datatype
= CHAN_TYPE
;
1812 case MESA_FORMAT_RGB888
:
1813 case MESA_FORMAT_BGR888
:
1814 *datatype
= GL_UNSIGNED_BYTE
;
1817 case MESA_FORMAT_RGB565
:
1818 case MESA_FORMAT_RGB565_REV
:
1819 *datatype
= GL_UNSIGNED_SHORT_5_6_5
;
1823 case MESA_FORMAT_ARGB4444
:
1824 case MESA_FORMAT_ARGB4444_REV
:
1825 *datatype
= GL_UNSIGNED_SHORT_4_4_4_4
;
1829 case MESA_FORMAT_ARGB1555
:
1830 case MESA_FORMAT_ARGB1555_REV
:
1831 *datatype
= GL_UNSIGNED_SHORT_1_5_5_5_REV
;
1835 case MESA_FORMAT_AL88
:
1836 case MESA_FORMAT_AL88_REV
:
1837 *datatype
= GL_UNSIGNED_BYTE
;
1840 case MESA_FORMAT_RGB332
:
1841 *datatype
= GL_UNSIGNED_BYTE_3_3_2
;
1845 case MESA_FORMAT_A8
:
1846 case MESA_FORMAT_L8
:
1847 case MESA_FORMAT_I8
:
1848 case MESA_FORMAT_CI8
:
1849 *datatype
= GL_UNSIGNED_BYTE
;
1853 case MESA_FORMAT_YCBCR
:
1854 case MESA_FORMAT_YCBCR_REV
:
1855 *datatype
= GL_UNSIGNED_SHORT
;
1859 case MESA_FORMAT_Z24_S8
:
1860 *datatype
= GL_UNSIGNED_INT
;
1861 *comps
= 1; /* XXX OK? */
1864 case MESA_FORMAT_S8_Z24
:
1865 *datatype
= GL_UNSIGNED_INT
;
1866 *comps
= 1; /* XXX OK? */
1869 case MESA_FORMAT_Z16
:
1870 *datatype
= GL_UNSIGNED_SHORT
;
1874 case MESA_FORMAT_Z32
:
1875 *datatype
= GL_UNSIGNED_INT
;
1879 case MESA_FORMAT_DUDV8
:
1880 *datatype
= GL_BYTE
;
1884 case MESA_FORMAT_SIGNED_RGBA8888
:
1885 case MESA_FORMAT_SIGNED_RGBA8888_REV
:
1886 *datatype
= GL_BYTE
;
1890 #if FEATURE_EXT_texture_sRGB
1891 case MESA_FORMAT_SRGB8
:
1892 *datatype
= GL_UNSIGNED_BYTE
;
1895 case MESA_FORMAT_SRGBA8
:
1896 case MESA_FORMAT_SARGB8
:
1897 *datatype
= GL_UNSIGNED_BYTE
;
1900 case MESA_FORMAT_SL8
:
1901 *datatype
= GL_UNSIGNED_BYTE
;
1904 case MESA_FORMAT_SLA8
:
1905 *datatype
= GL_UNSIGNED_BYTE
;
1910 #if FEATURE_texture_fxt1
1911 case MESA_FORMAT_RGB_FXT1
:
1912 case MESA_FORMAT_RGBA_FXT1
:
1914 #if FEATURE_texture_s3tc
1915 case MESA_FORMAT_RGB_DXT1
:
1916 case MESA_FORMAT_RGBA_DXT1
:
1917 case MESA_FORMAT_RGBA_DXT3
:
1918 case MESA_FORMAT_RGBA_DXT5
:
1919 #if FEATURE_EXT_texture_sRGB
1920 case MESA_FORMAT_SRGB_DXT1
:
1921 case MESA_FORMAT_SRGBA_DXT1
:
1922 case MESA_FORMAT_SRGBA_DXT3
:
1923 case MESA_FORMAT_SRGBA_DXT5
:
1925 /* XXX generate error instead? */
1926 *datatype
= GL_UNSIGNED_BYTE
;
1931 case MESA_FORMAT_RGBA
:
1932 *datatype
= CHAN_TYPE
;
1935 case MESA_FORMAT_RGB
:
1936 *datatype
= CHAN_TYPE
;
1939 case MESA_FORMAT_LUMINANCE_ALPHA
:
1940 *datatype
= CHAN_TYPE
;
1943 case MESA_FORMAT_ALPHA
:
1944 case MESA_FORMAT_LUMINANCE
:
1945 case MESA_FORMAT_INTENSITY
:
1946 *datatype
= CHAN_TYPE
;
1950 case MESA_FORMAT_RGBA_FLOAT32
:
1951 *datatype
= GL_FLOAT
;
1954 case MESA_FORMAT_RGBA_FLOAT16
:
1955 *datatype
= GL_HALF_FLOAT_ARB
;
1958 case MESA_FORMAT_RGB_FLOAT32
:
1959 *datatype
= GL_FLOAT
;
1962 case MESA_FORMAT_RGB_FLOAT16
:
1963 *datatype
= GL_HALF_FLOAT_ARB
;
1966 case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
:
1967 *datatype
= GL_FLOAT
;
1970 case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
:
1971 *datatype
= GL_HALF_FLOAT_ARB
;
1974 case MESA_FORMAT_ALPHA_FLOAT32
:
1975 case MESA_FORMAT_LUMINANCE_FLOAT32
:
1976 case MESA_FORMAT_INTENSITY_FLOAT32
:
1977 *datatype
= GL_FLOAT
;
1980 case MESA_FORMAT_ALPHA_FLOAT16
:
1981 case MESA_FORMAT_LUMINANCE_FLOAT16
:
1982 case MESA_FORMAT_INTENSITY_FLOAT16
:
1983 *datatype
= GL_HALF_FLOAT_ARB
;
1988 _mesa_problem(NULL
, "bad format in _mesa_format_to_type_and_comps");
1997 * Table to map MESA_FORMAT_ to texel fetch/store funcs.
1998 * XXX this is somewhat temporary.
2002 FetchTexelFuncF Fetch1D
;
2003 FetchTexelFuncF Fetch2D
;
2004 FetchTexelFuncF Fetch3D
;
2005 StoreTexelFunc StoreTexel
;
2007 texfetch_funcs
[MESA_FORMAT_COUNT
] =
2011 fetch_texel_1d_f_rgba
,
2012 fetch_texel_2d_f_rgba
,
2013 fetch_texel_3d_f_rgba
,
2018 fetch_texel_1d_f_rgb
,
2019 fetch_texel_2d_f_rgb
,
2020 fetch_texel_3d_f_rgb
,
2025 fetch_texel_1d_f_alpha
,
2026 fetch_texel_2d_f_alpha
,
2027 fetch_texel_3d_f_alpha
,
2031 MESA_FORMAT_LUMINANCE
,
2032 fetch_texel_1d_f_luminance
,
2033 fetch_texel_2d_f_luminance
,
2034 fetch_texel_3d_f_luminance
,
2035 store_texel_luminance
2038 MESA_FORMAT_LUMINANCE_ALPHA
,
2039 fetch_texel_1d_f_luminance_alpha
,
2040 fetch_texel_2d_f_luminance_alpha
,
2041 fetch_texel_3d_f_luminance_alpha
,
2042 store_texel_luminance_alpha
2045 MESA_FORMAT_INTENSITY
,
2046 fetch_texel_1d_f_intensity
,
2047 fetch_texel_2d_f_intensity
,
2048 fetch_texel_3d_f_intensity
,
2049 store_texel_intensity
2053 fetch_texel_1d_srgb8
,
2054 fetch_texel_2d_srgb8
,
2055 fetch_texel_3d_srgb8
,
2060 fetch_texel_1d_srgba8
,
2061 fetch_texel_2d_srgba8
,
2062 fetch_texel_3d_srgba8
,
2067 fetch_texel_1d_sargb8
,
2068 fetch_texel_2d_sargb8
,
2069 fetch_texel_3d_sargb8
,
2081 fetch_texel_1d_sla8
,
2082 fetch_texel_2d_sla8
,
2083 fetch_texel_3d_sla8
,
2087 MESA_FORMAT_RGB_FXT1
,
2089 _mesa_fetch_texel_2d_f_rgb_fxt1
,
2094 MESA_FORMAT_RGBA_FXT1
,
2096 _mesa_fetch_texel_2d_f_rgba_fxt1
,
2101 MESA_FORMAT_RGB_DXT1
,
2103 _mesa_fetch_texel_2d_f_rgb_dxt1
,
2108 MESA_FORMAT_RGBA_DXT1
,
2110 _mesa_fetch_texel_2d_f_rgba_dxt1
,
2115 MESA_FORMAT_RGBA_DXT3
,
2117 _mesa_fetch_texel_2d_f_rgba_dxt3
,
2122 MESA_FORMAT_RGBA_DXT5
,
2124 _mesa_fetch_texel_2d_f_rgba_dxt5
,
2129 MESA_FORMAT_SRGB_DXT1
,
2131 _mesa_fetch_texel_2d_f_srgb_dxt1
,
2136 MESA_FORMAT_SRGBA_DXT1
,
2138 _mesa_fetch_texel_2d_f_srgba_dxt1
,
2143 MESA_FORMAT_SRGBA_DXT3
,
2145 _mesa_fetch_texel_2d_f_srgba_dxt3
,
2150 MESA_FORMAT_SRGBA_DXT5
,
2152 _mesa_fetch_texel_2d_f_srgba_dxt5
,
2157 MESA_FORMAT_RGBA_FLOAT32
,
2158 fetch_texel_1d_f_rgba_f32
,
2159 fetch_texel_2d_f_rgba_f32
,
2160 fetch_texel_3d_f_rgba_f32
,
2161 store_texel_rgba_f32
2164 MESA_FORMAT_RGBA_FLOAT16
,
2165 fetch_texel_1d_f_rgba_f16
,
2166 fetch_texel_2d_f_rgba_f16
,
2167 fetch_texel_3d_f_rgba_f16
,
2168 store_texel_rgba_f16
2171 MESA_FORMAT_RGB_FLOAT32
,
2172 fetch_texel_1d_f_rgb_f32
,
2173 fetch_texel_2d_f_rgb_f32
,
2174 fetch_texel_3d_f_rgb_f32
,
2178 MESA_FORMAT_RGB_FLOAT16
,
2179 fetch_texel_1d_f_rgb_f16
,
2180 fetch_texel_2d_f_rgb_f16
,
2181 fetch_texel_3d_f_rgb_f16
,
2185 MESA_FORMAT_ALPHA_FLOAT32
,
2186 fetch_texel_1d_f_alpha_f32
,
2187 fetch_texel_2d_f_alpha_f32
,
2188 fetch_texel_3d_f_alpha_f32
,
2189 store_texel_alpha_f32
2192 MESA_FORMAT_ALPHA_FLOAT16
,
2193 fetch_texel_1d_f_alpha_f16
,
2194 fetch_texel_2d_f_alpha_f16
,
2195 fetch_texel_3d_f_alpha_f16
,
2196 store_texel_alpha_f16
2199 MESA_FORMAT_LUMINANCE_FLOAT32
,
2200 fetch_texel_1d_f_luminance_f32
,
2201 fetch_texel_2d_f_luminance_f32
,
2202 fetch_texel_3d_f_luminance_f32
,
2203 store_texel_luminance_f32
2206 MESA_FORMAT_LUMINANCE_FLOAT16
,
2207 fetch_texel_1d_f_luminance_f16
,
2208 fetch_texel_2d_f_luminance_f16
,
2209 fetch_texel_3d_f_luminance_f16
,
2210 store_texel_luminance_f16
2213 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
,
2214 fetch_texel_1d_f_luminance_alpha_f32
,
2215 fetch_texel_2d_f_luminance_alpha_f32
,
2216 fetch_texel_3d_f_luminance_alpha_f32
,
2217 store_texel_luminance_alpha_f32
2220 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
,
2221 fetch_texel_1d_f_luminance_alpha_f16
,
2222 fetch_texel_2d_f_luminance_alpha_f16
,
2223 fetch_texel_3d_f_luminance_alpha_f16
,
2224 store_texel_luminance_alpha_f16
2227 MESA_FORMAT_INTENSITY_FLOAT32
,
2228 fetch_texel_1d_f_intensity_f32
,
2229 fetch_texel_2d_f_intensity_f32
,
2230 fetch_texel_3d_f_intensity_f32
,
2231 store_texel_intensity_f32
2234 MESA_FORMAT_INTENSITY_FLOAT16
,
2235 fetch_texel_1d_f_intensity_f16
,
2236 fetch_texel_2d_f_intensity_f16
,
2237 fetch_texel_3d_f_intensity_f16
,
2238 store_texel_intensity_f16
2242 fetch_texel_1d_dudv8
,
2243 fetch_texel_2d_dudv8
,
2244 fetch_texel_3d_dudv8
,
2248 MESA_FORMAT_SIGNED_RGBA8888
,
2249 fetch_texel_1d_signed_rgba8888
,
2250 fetch_texel_2d_signed_rgba8888
,
2251 fetch_texel_3d_signed_rgba8888
,
2252 store_texel_signed_rgba8888
2255 MESA_FORMAT_SIGNED_RGBA8888_REV
,
2256 fetch_texel_1d_signed_rgba8888_rev
,
2257 fetch_texel_2d_signed_rgba8888_rev
,
2258 fetch_texel_3d_signed_rgba8888_rev
,
2259 store_texel_signed_rgba8888_rev
2262 MESA_FORMAT_RGBA8888
,
2263 fetch_texel_1d_f_rgba8888
,
2264 fetch_texel_2d_f_rgba8888
,
2265 fetch_texel_3d_f_rgba8888
,
2266 store_texel_rgba8888
2269 MESA_FORMAT_RGBA8888_REV
,
2270 fetch_texel_1d_f_rgba8888_rev
,
2271 fetch_texel_2d_f_rgba8888_rev
,
2272 fetch_texel_3d_f_rgba8888_rev
,
2273 store_texel_rgba8888_rev
2276 MESA_FORMAT_ARGB8888
,
2277 fetch_texel_1d_f_argb8888
,
2278 fetch_texel_2d_f_argb8888
,
2279 fetch_texel_3d_f_argb8888
,
2280 store_texel_argb8888
2283 MESA_FORMAT_ARGB8888_REV
,
2284 fetch_texel_1d_f_argb8888_rev
,
2285 fetch_texel_2d_f_argb8888_rev
,
2286 fetch_texel_3d_f_argb8888_rev
,
2287 store_texel_argb8888_rev
2291 fetch_texel_1d_f_rgb888
,
2292 fetch_texel_2d_f_rgb888
,
2293 fetch_texel_3d_f_rgb888
,
2298 fetch_texel_1d_f_bgr888
,
2299 fetch_texel_2d_f_bgr888
,
2300 fetch_texel_3d_f_bgr888
,
2305 fetch_texel_1d_f_rgb565
,
2306 fetch_texel_2d_f_rgb565
,
2307 fetch_texel_3d_f_rgb565
,
2311 MESA_FORMAT_RGB565_REV
,
2312 fetch_texel_1d_f_rgb565_rev
,
2313 fetch_texel_2d_f_rgb565_rev
,
2314 fetch_texel_3d_f_rgb565_rev
,
2315 store_texel_rgb565_rev
2318 MESA_FORMAT_RGBA4444
,
2319 fetch_texel_1d_f_rgba4444
,
2320 fetch_texel_2d_f_rgba4444
,
2321 fetch_texel_3d_f_rgba4444
,
2322 store_texel_rgba4444
2325 MESA_FORMAT_ARGB4444
,
2326 fetch_texel_1d_f_argb4444
,
2327 fetch_texel_2d_f_argb4444
,
2328 fetch_texel_3d_f_argb4444
,
2329 store_texel_argb4444
2332 MESA_FORMAT_ARGB4444_REV
,
2333 fetch_texel_1d_f_argb4444_rev
,
2334 fetch_texel_2d_f_argb4444_rev
,
2335 fetch_texel_3d_f_argb4444_rev
,
2336 store_texel_argb4444_rev
2339 MESA_FORMAT_RGBA5551
,
2340 fetch_texel_1d_f_rgba5551
,
2341 fetch_texel_2d_f_rgba5551
,
2342 fetch_texel_3d_f_rgba5551
,
2343 store_texel_rgba5551
2346 MESA_FORMAT_ARGB1555
,
2347 fetch_texel_1d_f_argb1555
,
2348 fetch_texel_2d_f_argb1555
,
2349 fetch_texel_3d_f_argb1555
,
2350 store_texel_argb1555
2353 MESA_FORMAT_ARGB1555_REV
,
2354 fetch_texel_1d_f_argb1555_rev
,
2355 fetch_texel_2d_f_argb1555_rev
,
2356 fetch_texel_3d_f_argb1555_rev
,
2357 store_texel_argb1555_rev
2361 fetch_texel_1d_f_al88
,
2362 fetch_texel_2d_f_al88
,
2363 fetch_texel_3d_f_al88
,
2367 MESA_FORMAT_AL88_REV
,
2368 fetch_texel_1d_f_al88_rev
,
2369 fetch_texel_2d_f_al88_rev
,
2370 fetch_texel_3d_f_al88_rev
,
2371 store_texel_al88_rev
2375 fetch_texel_1d_f_rgb332
,
2376 fetch_texel_2d_f_rgb332
,
2377 fetch_texel_3d_f_rgb332
,
2382 fetch_texel_1d_f_a8
,
2383 fetch_texel_2d_f_a8
,
2384 fetch_texel_3d_f_a8
,
2389 fetch_texel_1d_f_l8
,
2390 fetch_texel_2d_f_l8
,
2391 fetch_texel_3d_f_l8
,
2396 fetch_texel_1d_f_i8
,
2397 fetch_texel_2d_f_i8
,
2398 fetch_texel_3d_f_i8
,
2403 fetch_texel_1d_f_ci8
,
2404 fetch_texel_2d_f_ci8
,
2405 fetch_texel_3d_f_ci8
,
2410 fetch_texel_1d_f_ycbcr
,
2411 fetch_texel_2d_f_ycbcr
,
2412 fetch_texel_3d_f_ycbcr
,
2416 MESA_FORMAT_YCBCR_REV
,
2417 fetch_texel_1d_f_ycbcr_rev
,
2418 fetch_texel_2d_f_ycbcr_rev
,
2419 fetch_texel_3d_f_ycbcr_rev
,
2420 store_texel_ycbcr_rev
2424 fetch_texel_1d_f_z24_s8
,
2425 fetch_texel_2d_f_z24_s8
,
2426 fetch_texel_3d_f_z24_s8
,
2431 fetch_texel_1d_f_s8_z24
,
2432 fetch_texel_2d_f_s8_z24
,
2433 fetch_texel_3d_f_s8_z24
,
2438 fetch_texel_1d_f_z16
,
2439 fetch_texel_2d_f_z16
,
2440 fetch_texel_3d_f_z16
,
2445 fetch_texel_1d_f_z32
,
2446 fetch_texel_2d_f_z32
,
2447 fetch_texel_3d_f_z32
,
2454 _mesa_get_texel_fetch_func(GLuint format
, GLuint dims
)
2457 /* XXX replace loop with direct table lookup */
2458 for (i
= 0; i
< MESA_FORMAT_COUNT
; i
++) {
2459 if (texfetch_funcs
[i
].Name
== format
) {
2462 return texfetch_funcs
[i
].Fetch1D
;
2464 return texfetch_funcs
[i
].Fetch2D
;
2466 return texfetch_funcs
[i
].Fetch3D
;
2475 _mesa_get_texel_store_func(GLuint format
)
2478 /* XXX replace loop with direct table lookup */
2479 for (i
= 0; i
< MESA_FORMAT_COUNT
; i
++) {
2480 if (texfetch_funcs
[i
].Name
== format
) {
2481 return texfetch_funcs
[i
].StoreTexel
;