1 /* $Id: texformat.c,v 1.15 2002/09/21 16:51:25 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * Gareth Hughes <gareth@valinux.com>
40 #include "texformat.h"
46 /* Texel fetch routines for all supported formats:
49 #include "texformat_tmp.h"
52 #include "texformat_tmp.h"
55 #include "texformat_tmp.h"
57 /* Have to have this so the FetchTexel function pointer is never NULL.
59 static void fetch_null_texel( const struct gl_texture_image
*texImage
,
60 GLint i
, GLint j
, GLint k
, GLvoid
*texel
)
62 GLchan
*rgba
= (GLchan
*) texel
;
70 /* =============================================================
71 * Default GLchan-based formats:
74 const struct gl_texture_format _mesa_texformat_rgba
= {
75 MESA_FORMAT_RGBA
, /* MesaFormat */
76 GL_RGBA
, /* BaseFormat */
78 CHAN_BITS
, /* RedBits */
79 CHAN_BITS
, /* GreenBits */
80 CHAN_BITS
, /* BlueBits */
81 CHAN_BITS
, /* AlphaBits */
82 0, /* LuminanceBits */
83 0, /* IntensityBits */
86 4 * CHAN_BITS
/ 8, /* TexelBytes */
87 fetch_1d_texel_rgba
, /* FetchTexel1D */
88 fetch_2d_texel_rgba
, /* FetchTexel2D */
89 fetch_3d_texel_rgba
, /* FetchTexel3D */
92 const struct gl_texture_format _mesa_texformat_rgb
= {
93 MESA_FORMAT_RGB
, /* MesaFormat */
94 GL_RGB
, /* BaseFormat */
96 CHAN_BITS
, /* RedBits */
97 CHAN_BITS
, /* GreenBits */
98 CHAN_BITS
, /* BlueBits */
100 0, /* LuminanceBits */
101 0, /* IntensityBits */
104 3 * CHAN_BITS
/ 8, /* TexelBytes */
105 fetch_1d_texel_rgb
, /* FetchTexel1D */
106 fetch_2d_texel_rgb
, /* FetchTexel2D */
107 fetch_3d_texel_rgb
, /* FetchTexel3D */
110 const struct gl_texture_format _mesa_texformat_alpha
= {
111 MESA_FORMAT_ALPHA
, /* MesaFormat */
112 GL_ALPHA
, /* BaseFormat */
113 CHAN_TYPE
, /* Type */
117 CHAN_BITS
, /* AlphaBits */
118 0, /* LuminanceBits */
119 0, /* IntensityBits */
122 CHAN_BITS
/ 8, /* TexelBytes */
123 fetch_1d_texel_alpha
, /* FetchTexel1D */
124 fetch_2d_texel_alpha
, /* FetchTexel2D */
125 fetch_3d_texel_alpha
, /* FetchTexel3D */
128 const struct gl_texture_format _mesa_texformat_luminance
= {
129 MESA_FORMAT_LUMINANCE
, /* MesaFormat */
130 GL_LUMINANCE
, /* BaseFormat */
131 CHAN_TYPE
, /* Type */
136 CHAN_BITS
, /* LuminanceBits */
137 0, /* IntensityBits */
140 CHAN_BITS
/ 8, /* TexelBytes */
141 fetch_1d_texel_luminance
, /* FetchTexel1D */
142 fetch_2d_texel_luminance
, /* FetchTexel2D */
143 fetch_3d_texel_luminance
, /* FetchTexel3D */
146 const struct gl_texture_format _mesa_texformat_luminance_alpha
= {
147 MESA_FORMAT_LUMINANCE_ALPHA
, /* MesaFormat */
148 GL_LUMINANCE_ALPHA
, /* BaseFormat */
149 CHAN_TYPE
, /* Type */
153 CHAN_BITS
, /* AlphaBits */
154 CHAN_BITS
, /* LuminanceBits */
155 0, /* IntensityBits */
158 2 * CHAN_BITS
/ 8, /* TexelBytes */
159 fetch_1d_texel_luminance_alpha
, /* FetchTexel1D */
160 fetch_2d_texel_luminance_alpha
, /* FetchTexel2D */
161 fetch_3d_texel_luminance_alpha
, /* FetchTexel3D */
164 const struct gl_texture_format _mesa_texformat_intensity
= {
165 MESA_FORMAT_INTENSITY
, /* MesaFormat */
166 GL_INTENSITY
, /* BaseFormat */
167 CHAN_TYPE
, /* Type */
172 0, /* LuminanceBits */
173 CHAN_BITS
, /* IntensityBits */
176 CHAN_BITS
/ 8, /* TexelBytes */
177 fetch_1d_texel_intensity
, /* FetchTexel1D */
178 fetch_2d_texel_intensity
, /* FetchTexel2D */
179 fetch_3d_texel_intensity
, /* FetchTexel3D */
182 const struct gl_texture_format _mesa_texformat_color_index
= {
183 MESA_FORMAT_COLOR_INDEX
, /* MesaFormat */
184 GL_COLOR_INDEX
, /* BaseFormat */
185 CHAN_TYPE
, /* Type */
190 0, /* LuminanceBits */
191 0, /* IntensityBits */
192 CHAN_BITS
, /* IndexBits */
194 CHAN_BITS
/ 8, /* TexelBytes */
195 fetch_1d_texel_color_index
, /* FetchTexel1D */
196 fetch_2d_texel_color_index
, /* FetchTexel2D */
197 fetch_3d_texel_color_index
, /* FetchTexel3D */
200 const struct gl_texture_format _mesa_texformat_depth_component
= {
201 MESA_FORMAT_DEPTH_COMPONENT
, /* MesaFormat */
202 GL_DEPTH_COMPONENT
, /* BaseFormat */
208 0, /* LuminanceBits */
209 0, /* IntensityBits */
211 sizeof(GLfloat
) * 8, /* DepthBits */
212 sizeof(GLfloat
), /* TexelBytes */
213 fetch_1d_texel_depth_component
, /* FetchTexel1D */
214 fetch_2d_texel_depth_component
, /* FetchTexel2D */
215 fetch_3d_texel_depth_component
, /* FetchTexel3D */
219 /* =============================================================
223 const struct gl_texture_format _mesa_texformat_rgba8888
= {
224 MESA_FORMAT_RGBA8888
, /* MesaFormat */
225 GL_RGBA
, /* BaseFormat */
226 GL_UNSIGNED_INT_8_8_8_8
, /* Type */
231 0, /* LuminanceBits */
232 0, /* IntensityBits */
236 fetch_1d_texel_rgba8888
, /* FetchTexel1D */
237 fetch_2d_texel_rgba8888
, /* FetchTexel2D */
238 fetch_3d_texel_rgba8888
, /* FetchTexel3D */
241 const struct gl_texture_format _mesa_texformat_argb8888
= {
242 MESA_FORMAT_ARGB8888
, /* MesaFormat */
243 GL_RGBA
, /* BaseFormat */
244 GL_UNSIGNED_INT_8_8_8_8_REV
, /* Type */
249 0, /* LuminanceBits */
250 0, /* IntensityBits */
254 fetch_1d_texel_argb8888
, /* FetchTexel1D */
255 fetch_2d_texel_argb8888
, /* FetchTexel2D */
256 fetch_3d_texel_argb8888
, /* FetchTexel3D */
259 const struct gl_texture_format _mesa_texformat_rgb888
= {
260 MESA_FORMAT_RGB888
, /* MesaFormat */
261 GL_RGB
, /* BaseFormat */
262 GL_UNSIGNED_BYTE
, /* Type */
267 0, /* LuminanceBits */
268 0, /* IntensityBits */
272 fetch_1d_texel_rgb888
, /* FetchTexel1D */
273 fetch_2d_texel_rgb888
, /* FetchTexel2D */
274 fetch_3d_texel_rgb888
, /* FetchTexel3D */
277 const struct gl_texture_format _mesa_texformat_rgb565
= {
278 MESA_FORMAT_RGB565
, /* MesaFormat */
279 GL_RGB
, /* BaseFormat */
280 GL_UNSIGNED_SHORT_5_6_5
, /* Type */
285 0, /* LuminanceBits */
286 0, /* IntensityBits */
290 fetch_1d_texel_rgb565
, /* FetchTexel1D */
291 fetch_2d_texel_rgb565
, /* FetchTexel2D */
292 fetch_3d_texel_rgb565
, /* FetchTexel3D */
295 const struct gl_texture_format _mesa_texformat_argb4444
= {
296 MESA_FORMAT_ARGB4444
, /* MesaFormat */
297 GL_RGBA
, /* BaseFormat */
298 GL_UNSIGNED_SHORT_4_4_4_4_REV
, /* Type */
303 0, /* LuminanceBits */
304 0, /* IntensityBits */
308 fetch_1d_texel_argb4444
, /* FetchTexel1D */
309 fetch_2d_texel_argb4444
, /* FetchTexel2D */
310 fetch_3d_texel_argb4444
, /* FetchTexel3D */
313 const struct gl_texture_format _mesa_texformat_argb1555
= {
314 MESA_FORMAT_ARGB1555
, /* MesaFormat */
315 GL_RGBA
, /* BaseFormat */
316 GL_UNSIGNED_SHORT_1_5_5_5_REV
, /* Type */
321 0, /* LuminanceBits */
322 0, /* IntensityBits */
326 fetch_1d_texel_argb1555
, /* FetchTexel1D */
327 fetch_2d_texel_argb1555
, /* FetchTexel2D */
328 fetch_3d_texel_argb1555
, /* FetchTexel3D */
331 const struct gl_texture_format _mesa_texformat_al88
= {
332 MESA_FORMAT_AL88
, /* MesaFormat */
333 GL_LUMINANCE_ALPHA
, /* BaseFormat */
334 GL_UNSIGNED_BYTE
, /* Type */
339 8, /* LuminanceBits */
340 0, /* IntensityBits */
344 fetch_1d_texel_al88
, /* FetchTexel1D */
345 fetch_2d_texel_al88
, /* FetchTexel2D */
346 fetch_3d_texel_al88
, /* FetchTexel3D */
349 const struct gl_texture_format _mesa_texformat_rgb332
= {
350 MESA_FORMAT_RGB332
, /* MesaFormat */
351 GL_RGB
, /* BaseFormat */
352 GL_UNSIGNED_BYTE_3_3_2
, /* Type */
357 0, /* LuminanceBits */
358 0, /* IntensityBits */
362 fetch_1d_texel_rgb332
, /* FetchTexel1D */
363 fetch_2d_texel_rgb332
, /* FetchTexel2D */
364 fetch_3d_texel_rgb332
, /* FetchTexel3D */
367 const struct gl_texture_format _mesa_texformat_a8
= {
368 MESA_FORMAT_A8
, /* MesaFormat */
369 GL_ALPHA
, /* BaseFormat */
370 GL_UNSIGNED_BYTE
, /* Type */
375 0, /* LuminanceBits */
376 0, /* IntensityBits */
380 fetch_1d_texel_a8
, /* FetchTexel1D */
381 fetch_2d_texel_a8
, /* FetchTexel2D */
382 fetch_3d_texel_a8
, /* FetchTexel3D */
385 const struct gl_texture_format _mesa_texformat_l8
= {
386 MESA_FORMAT_L8
, /* MesaFormat */
387 GL_LUMINANCE
, /* BaseFormat */
388 GL_UNSIGNED_BYTE
, /* Type */
393 8, /* LuminanceBits */
394 0, /* IntensityBits */
398 fetch_1d_texel_l8
, /* FetchTexel1D */
399 fetch_2d_texel_l8
, /* FetchTexel2D */
400 fetch_3d_texel_l8
, /* FetchTexel3D */
403 const struct gl_texture_format _mesa_texformat_i8
= {
404 MESA_FORMAT_I8
, /* MesaFormat */
405 GL_INTENSITY
, /* BaseFormat */
406 GL_UNSIGNED_BYTE
, /* Type */
411 0, /* LuminanceBits */
412 8, /* IntensityBits */
416 fetch_1d_texel_i8
, /* FetchTexel1D */
417 fetch_2d_texel_i8
, /* FetchTexel2D */
418 fetch_3d_texel_i8
, /* FetchTexel3D */
421 const struct gl_texture_format _mesa_texformat_ci8
= {
422 MESA_FORMAT_CI8
, /* MesaFormat */
423 GL_COLOR_INDEX
, /* BaseFormat */
424 GL_UNSIGNED_BYTE
, /* Type */
429 0, /* LuminanceBits */
430 0, /* IntensityBits */
434 fetch_1d_texel_ci8
, /* FetchTexel1D */
435 fetch_2d_texel_ci8
, /* FetchTexel2D */
436 fetch_3d_texel_ci8
, /* FetchTexel3D */
440 const struct gl_texture_format _mesa_texformat_ycbcr
= {
441 MESA_FORMAT_YCBCR
, /* MesaFormat */
442 GL_YCBCR_MESA
, /* BaseFormat */
443 GL_UNSIGNED_SHORT_8_8_MESA
, /* Type */
448 0, /* LuminanceBits */
449 0, /* IntensityBits */
453 fetch_1d_texel_ycbcr
, /* FetchTexel1D */
454 fetch_2d_texel_ycbcr
, /* FetchTexel2D */
455 fetch_3d_texel_ycbcr
, /* FetchTexel3D */
459 const struct gl_texture_format _mesa_texformat_ycbcr_rev
= {
460 MESA_FORMAT_YCBCR_REV
, /* MesaFormat */
461 GL_YCBCR_MESA
, /* BaseFormat */
462 GL_UNSIGNED_SHORT_8_8_REV_MESA
, /* Type */
467 0, /* LuminanceBits */
468 0, /* IntensityBits */
472 fetch_1d_texel_ycbcr_rev
, /* FetchTexel1D */
473 fetch_2d_texel_ycbcr_rev
, /* FetchTexel2D */
474 fetch_3d_texel_ycbcr_rev
, /* FetchTexel3D */
480 const struct gl_texture_format _mesa_texformat_abgr8888
= {
481 MESA_FORMAT_ABGR8888
, /* MesaFormat */
482 GL_RGBA
, /* BaseFormat */
483 GL_UNSIGNED_INT_8_8_8_8
, /* Type */
488 0, /* LuminanceBits */
489 0, /* IntensityBits */
493 fetch_1d_texel_abgr8888
, /* FetchTexel1D */
494 fetch_2d_texel_abgr8888
, /* FetchTexel2D */
495 fetch_3d_texel_abgr8888
, /* FetchTexel3D */
498 const struct gl_texture_format _mesa_texformat_bgra8888
= {
499 MESA_FORMAT_BGRA8888
, /* MesaFormat */
500 GL_RGBA
, /* BaseFormat */
501 GL_UNSIGNED_INT_8_8_8_8
, /* Type */
506 0, /* LuminanceBits */
507 0, /* IntensityBits */
511 fetch_1d_texel_bgra8888
, /* FetchTexel1D */
512 fetch_2d_texel_bgra8888
, /* FetchTexel2D */
513 fetch_3d_texel_bgra8888
, /* FetchTexel3D */
516 const struct gl_texture_format _mesa_texformat_bgr888
= {
517 MESA_FORMAT_BGR888
, /* MesaFormat */
518 GL_RGB
, /* BaseFormat */
519 GL_UNSIGNED_BYTE
, /* Type */
524 0, /* LuminanceBits */
525 0, /* IntensityBits */
529 fetch_1d_texel_bgr888
, /* FetchTexel1D */
530 fetch_2d_texel_bgr888
, /* FetchTexel2D */
531 fetch_3d_texel_bgr888
, /* FetchTexel3D */
534 const struct gl_texture_format _mesa_texformat_bgr565
= {
535 MESA_FORMAT_BGR565
, /* MesaFormat */
536 GL_RGB
, /* BaseFormat */
537 GL_UNSIGNED_SHORT_5_6_5
, /* Type */
542 0, /* LuminanceBits */
543 0, /* IntensityBits */
547 fetch_1d_texel_bgr565
, /* FetchTexel1D */
548 fetch_2d_texel_bgr565
, /* FetchTexel2D */
549 fetch_3d_texel_bgr565
, /* FetchTexel3D */
552 const struct gl_texture_format _mesa_texformat_bgra4444
= {
553 MESA_FORMAT_BGRA4444
, /* MesaFormat */
554 GL_RGBA
, /* BaseFormat */
555 GL_UNSIGNED_SHORT_4_4_4_4_REV
, /* Type */
560 0, /* LuminanceBits */
561 0, /* IntensityBits */
565 fetch_1d_texel_bgra4444
, /* FetchTexel1D */
566 fetch_2d_texel_bgra4444
, /* FetchTexel2D */
567 fetch_3d_texel_bgra4444
, /* FetchTexel3D */
570 const struct gl_texture_format _mesa_texformat_bgra5551
= {
571 MESA_FORMAT_BGRA5551
, /* MesaFormat */
572 GL_RGBA
, /* BaseFormat */
573 GL_UNSIGNED_SHORT_1_5_5_5_REV
, /* Type */
578 0, /* LuminanceBits */
579 0, /* IntensityBits */
583 fetch_1d_texel_bgra1555
, /* FetchTexel1D */
584 fetch_2d_texel_bgra1555
, /* FetchTexel2D */
585 fetch_3d_texel_bgra1555
, /* FetchTexel3D */
588 const struct gl_texture_format _mesa_texformat_la88
= {
589 MESA_FORMAT_LA88
, /* MesaFormat */
590 GL_LUMINANCE_ALPHA
, /* BaseFormat */
591 GL_UNSIGNED_BYTE
, /* Type */
596 8, /* LuminanceBits */
597 0, /* IntensityBits */
601 fetch_1d_texel_la88
, /* FetchTexel1D */
602 fetch_2d_texel_la88
, /* FetchTexel2D */
603 fetch_3d_texel_la88
, /* FetchTexel3D */
606 const struct gl_texture_format _mesa_texformat_bgr233
= {
607 MESA_FORMAT_BGR233
, /* MesaFormat */
608 GL_RGB
, /* BaseFormat */
609 GL_UNSIGNED_BYTE_3_3_2
, /* Type */
614 0, /* LuminanceBits */
615 0, /* IntensityBits */
619 fetch_1d_texel_bgr233
, /* FetchTexel1D */
620 fetch_2d_texel_bgr233
, /* FetchTexel2D */
621 fetch_3d_texel_bgr233
, /* FetchTexel3D */
625 /* =============================================================
629 const struct gl_texture_format _mesa_null_texformat
= {
637 0, /* LuminanceBits */
638 0, /* IntensityBits */
642 fetch_null_texel
, /* FetchTexel1D */
643 fetch_null_texel
, /* FetchTexel2D */
644 fetch_null_texel
, /* FetchTexel3D */
650 _mesa_is_hardware_tex_format( const struct gl_texture_format
*format
)
652 return (format
->MesaFormat
< MESA_FORMAT_RGBA
);
656 /* Given an internal texture format (or 1, 2, 3, 4) return a pointer
657 * to a gl_texture_format which which to store the texture.
658 * This is called via ctx->Driver.ChooseTextureFormat().
659 * Hardware drivers typically override this function with a specialized
662 const struct gl_texture_format
*
663 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
664 GLenum format
, GLenum type
)
669 switch ( internalFormat
) {
670 /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has
671 * got to be better than sticking them way down the end of this
674 case 4: /* Quake3 uses this... */
676 return &_mesa_texformat_rgba
;
678 case 3: /* ... and this. */
680 return &_mesa_texformat_rgb
;
682 /* GH: Okay, keep checking as normal. Still test for GL_RGB,
683 * GL_RGBA formats first.
692 return &_mesa_texformat_rgba
;
701 return &_mesa_texformat_rgb
;
708 return &_mesa_texformat_alpha
;
716 return &_mesa_texformat_luminance
;
719 case GL_LUMINANCE_ALPHA
:
720 case GL_LUMINANCE4_ALPHA4
:
721 case GL_LUMINANCE6_ALPHA2
:
722 case GL_LUMINANCE8_ALPHA8
:
723 case GL_LUMINANCE12_ALPHA4
:
724 case GL_LUMINANCE12_ALPHA12
:
725 case GL_LUMINANCE16_ALPHA16
:
726 return &_mesa_texformat_luminance_alpha
;
733 return &_mesa_texformat_intensity
;
736 case GL_COLOR_INDEX1_EXT
:
737 case GL_COLOR_INDEX2_EXT
:
738 case GL_COLOR_INDEX4_EXT
:
739 case GL_COLOR_INDEX8_EXT
:
740 case GL_COLOR_INDEX12_EXT
:
741 case GL_COLOR_INDEX16_EXT
:
742 return &_mesa_texformat_color_index
;
744 case GL_DEPTH_COMPONENT
:
745 case GL_DEPTH_COMPONENT16_SGIX
:
746 case GL_DEPTH_COMPONENT24_SGIX
:
747 case GL_DEPTH_COMPONENT32_SGIX
:
748 if (!ctx
->Extensions
.SGIX_depth_texture
)
749 _mesa_problem(ctx
, "depth format without GL_SGIX_depth_texture");
750 return &_mesa_texformat_depth_component
;
752 case GL_COMPRESSED_ALPHA_ARB
:
753 if (!ctx
->Extensions
.ARB_texture_compression
)
754 _mesa_problem(ctx
, "texture compression extension not enabled");
755 return &_mesa_texformat_alpha
;
756 case GL_COMPRESSED_LUMINANCE_ARB
:
757 if (!ctx
->Extensions
.ARB_texture_compression
)
758 _mesa_problem(ctx
, "texture compression extension not enabled");
759 return &_mesa_texformat_luminance
;
760 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
761 if (!ctx
->Extensions
.ARB_texture_compression
)
762 _mesa_problem(ctx
, "texture compression extension not enabled");
763 return &_mesa_texformat_luminance_alpha
;
764 case GL_COMPRESSED_INTENSITY_ARB
:
765 if (!ctx
->Extensions
.ARB_texture_compression
)
766 _mesa_problem(ctx
, "texture compression extension not enabled");
767 return &_mesa_texformat_intensity
;
768 case GL_COMPRESSED_RGB_ARB
:
769 if (!ctx
->Extensions
.ARB_texture_compression
)
770 _mesa_problem(ctx
, "texture compression extension not enabled");
771 return &_mesa_texformat_rgb
;
772 case GL_COMPRESSED_RGBA_ARB
:
773 if (!ctx
->Extensions
.ARB_texture_compression
)
774 _mesa_problem(ctx
, "texture compression extension not enabled");
775 return &_mesa_texformat_rgba
;
778 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
)
779 return &_mesa_texformat_ycbcr
;
781 return &_mesa_texformat_ycbcr_rev
;
784 _mesa_problem(ctx
, "unexpected format in _mesa_choose_tex_format()");
785 _mesa_debug(ctx
, "intformat = %d %x\n", internalFormat
, internalFormat
);
794 * Return the base texture format for the given compressed format
795 * Called via ctx->Driver.BaseCompressedTexFormat().
796 * This function is used by software rasterizers. Hardware drivers
797 * which support texture compression should not use this function but
798 * a specialized function instead.
801 _mesa_base_compressed_texformat(GLcontext
*ctx
, GLint intFormat
)
804 case GL_COMPRESSED_ALPHA_ARB
:
806 case GL_COMPRESSED_LUMINANCE_ARB
:
808 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
809 return GL_LUMINANCE_ALPHA
;
810 case GL_COMPRESSED_INTENSITY_ARB
:
812 case GL_COMPRESSED_RGB_ARB
:
814 case GL_COMPRESSED_RGBA_ARB
:
817 return -1; /* not a recognized compressed format */
823 * Called via ctx->Driver.CompressedTextureSize().
824 * This function is only used by software rasterizers.
825 * Hardware drivers will have to implement a specialized function.
828 _mesa_compressed_texture_size(GLcontext
*ctx
,
829 const struct gl_texture_image
*texImage
)
833 assert(texImage
->TexFormat
);
835 b
= texImage
->Width
* texImage
->Height
* texImage
->Depth
*
836 texImage
->TexFormat
->TexelBytes
;