2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 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.
28 * \file texcompress_s3tc.c
29 * GL_EXT_texture_compression_s3tc support.
32 #ifndef USE_EXTERNAL_DXTN_LIB
33 #define USE_EXTERNAL_DXTN_LIB 1
43 #include "texcompress.h"
44 #include "texcompress_s3tc.h"
45 #include "texformat.h"
49 #define DXTN_LIBNAME "dxtn.dll"
52 #elif defined(__DJGPP__)
53 #define DXTN_LIBNAME "dxtn.dxe"
55 #define DXTN_LIBNAME "libtxc_dxtn.so"
58 #if FEATURE_EXT_texture_sRGB
60 * Convert an 8-bit sRGB value from non-linear space to a
61 * linear RGB value in [0, 1].
62 * Implemented with a 256-entry lookup table.
65 nonlinear_to_linear(GLubyte cs8
)
67 static GLfloat table
[256];
68 static GLboolean tableReady
= GL_FALSE
;
70 /* compute lookup table now */
72 for (i
= 0; i
< 256; i
++) {
73 const GLfloat cs
= UBYTE_TO_FLOAT(i
);
75 table
[i
] = cs
/ 12.92f
;
78 table
[i
] = (GLfloat
) _mesa_pow((cs
+ 0.055) / 1.055, 2.4);
85 #endif /* FEATURE_EXT_texture_sRGB */
87 typedef void (*dxtFetchTexelFuncExt
)( GLint srcRowstride
, GLubyte
*pixdata
, GLint col
, GLint row
, GLvoid
*texelOut
);
89 dxtFetchTexelFuncExt fetch_ext_rgb_dxt1
= NULL
;
90 dxtFetchTexelFuncExt fetch_ext_rgba_dxt1
= NULL
;
91 dxtFetchTexelFuncExt fetch_ext_rgba_dxt3
= NULL
;
92 dxtFetchTexelFuncExt fetch_ext_rgba_dxt5
= NULL
;
94 typedef void (*dxtCompressTexFuncExt
)(GLint srccomps
, GLint width
,
95 GLint height
, const GLchan
*srcPixData
,
96 GLenum destformat
, GLubyte
*dest
,
99 static dxtCompressTexFuncExt ext_tx_compress_dxtn
= NULL
;
101 static void *dxtlibhandle
= NULL
;
105 _mesa_init_texture_s3tc( GLcontext
*ctx
)
107 /* called during context initialization */
108 ctx
->Mesa_DXTn
= GL_FALSE
;
109 #if USE_EXTERNAL_DXTN_LIB
111 dxtlibhandle
= _mesa_dlopen(DXTN_LIBNAME
, 0);
113 _mesa_warning(ctx
, "couldn't open " DXTN_LIBNAME
", software DXTn "
114 "compression/decompression unavailable");
117 /* the fetch functions are not per context! Might be problematic... */
118 fetch_ext_rgb_dxt1
= (dxtFetchTexelFuncExt
)
119 _mesa_dlsym(dxtlibhandle
, "fetch_2d_texel_rgb_dxt1");
120 fetch_ext_rgba_dxt1
= (dxtFetchTexelFuncExt
)
121 _mesa_dlsym(dxtlibhandle
, "fetch_2d_texel_rgba_dxt1");
122 fetch_ext_rgba_dxt3
= (dxtFetchTexelFuncExt
)
123 _mesa_dlsym(dxtlibhandle
, "fetch_2d_texel_rgba_dxt3");
124 fetch_ext_rgba_dxt5
= (dxtFetchTexelFuncExt
)
125 _mesa_dlsym(dxtlibhandle
, "fetch_2d_texel_rgba_dxt5");
126 ext_tx_compress_dxtn
= (dxtCompressTexFuncExt
)
127 _mesa_dlsym(dxtlibhandle
, "tx_compress_dxtn");
129 if (!fetch_ext_rgb_dxt1
||
130 !fetch_ext_rgba_dxt1
||
131 !fetch_ext_rgba_dxt3
||
132 !fetch_ext_rgba_dxt5
||
133 !ext_tx_compress_dxtn
) {
134 _mesa_warning(ctx
, "couldn't reference all symbols in "
135 DXTN_LIBNAME
", software DXTn compression/decompression "
137 fetch_ext_rgb_dxt1
= NULL
;
138 fetch_ext_rgba_dxt1
= NULL
;
139 fetch_ext_rgba_dxt3
= NULL
;
140 fetch_ext_rgba_dxt5
= NULL
;
141 ext_tx_compress_dxtn
= NULL
;
142 _mesa_dlclose(dxtlibhandle
);
148 ctx
->Mesa_DXTn
= GL_TRUE
;
149 _mesa_warning(ctx
, "software DXTn compression/decompression available");
157 * Store user's image in rgb_dxt1 format.
160 _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS
)
162 const GLchan
*pixels
;
165 const GLint texWidth
= dstRowStride
* 4 / 8; /* a bit of a hack */
166 const GLchan
*tempImage
= NULL
;
168 ASSERT(dstFormat
== &_mesa_texformat_rgb_dxt1
);
169 ASSERT(dstXoffset
% 4 == 0);
170 ASSERT(dstYoffset
% 4 == 0);
171 ASSERT(dstZoffset
% 4 == 0);
173 (void) dstImageOffsets
;
175 if (srcFormat
!= GL_RGB
||
176 srcType
!= CHAN_TYPE
||
177 ctx
->_ImageTransferState
||
178 srcPacking
->SwapBytes
) {
179 /* convert image to RGB/GLchan */
180 tempImage
= _mesa_make_temp_chan_image(ctx
, dims
,
182 dstFormat
->BaseFormat
,
183 srcWidth
, srcHeight
, srcDepth
,
184 srcFormat
, srcType
, srcAddr
,
187 return GL_FALSE
; /* out of memory */
188 _mesa_adjust_image_for_convolution(ctx
, dims
, &srcWidth
, &srcHeight
);
190 srcRowStride
= 3 * srcWidth
;
194 pixels
= (const GLchan
*) srcAddr
;
195 srcRowStride
= _mesa_image_row_stride(srcPacking
, srcWidth
, srcFormat
,
196 srcType
) / sizeof(GLchan
);
199 dst
= _mesa_compressed_image_address(dstXoffset
, dstYoffset
, 0,
200 dstFormat
->MesaFormat
,
201 texWidth
, (GLubyte
*) dstAddr
);
203 if (ext_tx_compress_dxtn
) {
204 (*ext_tx_compress_dxtn
)(3, srcWidth
, srcHeight
, pixels
,
205 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
,
209 _mesa_warning(ctx
, "external dxt library not available: texstore_rgb_dxt1");
213 _mesa_free((void *) tempImage
);
220 * Store user's image in rgba_dxt1 format.
223 _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS
)
225 const GLchan
*pixels
;
228 const GLint texWidth
= dstRowStride
* 4 / 8; /* a bit of a hack */
229 const GLchan
*tempImage
= NULL
;
231 ASSERT(dstFormat
== &_mesa_texformat_rgba_dxt1
);
232 ASSERT(dstXoffset
% 4 == 0);
233 ASSERT(dstYoffset
% 4 == 0);
234 ASSERT(dstZoffset
% 4 == 0);
236 (void) dstImageOffsets
;
238 if (srcFormat
!= GL_RGBA
||
239 srcType
!= CHAN_TYPE
||
240 ctx
->_ImageTransferState
||
241 srcPacking
->SwapBytes
) {
242 /* convert image to RGBA/GLchan */
243 tempImage
= _mesa_make_temp_chan_image(ctx
, dims
,
245 dstFormat
->BaseFormat
,
246 srcWidth
, srcHeight
, srcDepth
,
247 srcFormat
, srcType
, srcAddr
,
250 return GL_FALSE
; /* out of memory */
251 _mesa_adjust_image_for_convolution(ctx
, dims
, &srcWidth
, &srcHeight
);
253 srcRowStride
= 4 * srcWidth
;
257 pixels
= (const GLchan
*) srcAddr
;
258 srcRowStride
= _mesa_image_row_stride(srcPacking
, srcWidth
, srcFormat
,
259 srcType
) / sizeof(GLchan
);
262 dst
= _mesa_compressed_image_address(dstXoffset
, dstYoffset
, 0,
263 dstFormat
->MesaFormat
,
264 texWidth
, (GLubyte
*) dstAddr
);
265 if (ext_tx_compress_dxtn
) {
266 (*ext_tx_compress_dxtn
)(4, srcWidth
, srcHeight
, pixels
,
267 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
,
271 _mesa_warning(ctx
, "external dxt library not available: texstore_rgba_dxt1");
275 _mesa_free((void*) tempImage
);
282 * Store user's image in rgba_dxt3 format.
285 _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS
)
287 const GLchan
*pixels
;
290 const GLint texWidth
= dstRowStride
* 4 / 16; /* a bit of a hack */
291 const GLchan
*tempImage
= NULL
;
293 ASSERT(dstFormat
== &_mesa_texformat_rgba_dxt3
);
294 ASSERT(dstXoffset
% 4 == 0);
295 ASSERT(dstYoffset
% 4 == 0);
296 ASSERT(dstZoffset
% 4 == 0);
298 (void) dstImageOffsets
;
300 if (srcFormat
!= GL_RGBA
||
301 srcType
!= CHAN_TYPE
||
302 ctx
->_ImageTransferState
||
303 srcPacking
->SwapBytes
) {
304 /* convert image to RGBA/GLchan */
305 tempImage
= _mesa_make_temp_chan_image(ctx
, dims
,
307 dstFormat
->BaseFormat
,
308 srcWidth
, srcHeight
, srcDepth
,
309 srcFormat
, srcType
, srcAddr
,
312 return GL_FALSE
; /* out of memory */
313 _mesa_adjust_image_for_convolution(ctx
, dims
, &srcWidth
, &srcHeight
);
315 srcRowStride
= 4 * srcWidth
;
318 pixels
= (const GLchan
*) srcAddr
;
319 srcRowStride
= _mesa_image_row_stride(srcPacking
, srcWidth
, srcFormat
,
320 srcType
) / sizeof(GLchan
);
323 dst
= _mesa_compressed_image_address(dstXoffset
, dstYoffset
, 0,
324 dstFormat
->MesaFormat
,
325 texWidth
, (GLubyte
*) dstAddr
);
326 if (ext_tx_compress_dxtn
) {
327 (*ext_tx_compress_dxtn
)(4, srcWidth
, srcHeight
, pixels
,
328 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
,
332 _mesa_warning(ctx
, "external dxt library not available: texstore_rgba_dxt3");
336 _mesa_free((void *) tempImage
);
343 * Store user's image in rgba_dxt5 format.
346 _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS
)
348 const GLchan
*pixels
;
351 const GLint texWidth
= dstRowStride
* 4 / 16; /* a bit of a hack */
352 const GLchan
*tempImage
= NULL
;
354 ASSERT(dstFormat
== &_mesa_texformat_rgba_dxt5
);
355 ASSERT(dstXoffset
% 4 == 0);
356 ASSERT(dstYoffset
% 4 == 0);
357 ASSERT(dstZoffset
% 4 == 0);
359 (void) dstImageOffsets
;
361 if (srcFormat
!= GL_RGBA
||
362 srcType
!= CHAN_TYPE
||
363 ctx
->_ImageTransferState
||
364 srcPacking
->SwapBytes
) {
365 /* convert image to RGBA/GLchan */
366 tempImage
= _mesa_make_temp_chan_image(ctx
, dims
,
368 dstFormat
->BaseFormat
,
369 srcWidth
, srcHeight
, srcDepth
,
370 srcFormat
, srcType
, srcAddr
,
373 return GL_FALSE
; /* out of memory */
374 _mesa_adjust_image_for_convolution(ctx
, dims
, &srcWidth
, &srcHeight
);
376 srcRowStride
= 4 * srcWidth
;
379 pixels
= (const GLchan
*) srcAddr
;
380 srcRowStride
= _mesa_image_row_stride(srcPacking
, srcWidth
, srcFormat
,
381 srcType
) / sizeof(GLchan
);
384 dst
= _mesa_compressed_image_address(dstXoffset
, dstYoffset
, 0,
385 dstFormat
->MesaFormat
,
386 texWidth
, (GLubyte
*) dstAddr
);
387 if (ext_tx_compress_dxtn
) {
388 (*ext_tx_compress_dxtn
)(4, srcWidth
, srcHeight
, pixels
,
389 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
,
393 _mesa_warning(ctx
, "external dxt library not available: texstore_rgba_dxt5");
397 _mesa_free((void *) tempImage
);
404 fetch_texel_2d_rgb_dxt1( const struct gl_texture_image
*texImage
,
405 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
408 if (fetch_ext_rgb_dxt1
) {
409 ASSERT (sizeof(GLchan
) == sizeof(GLubyte
));
410 fetch_ext_rgb_dxt1(texImage
->RowStride
,
411 (GLubyte
*)(texImage
)->Data
, i
, j
, texel
);
414 _mesa_debug(NULL
, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
419 _mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image
*texImage
,
420 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
422 /* just sample as GLchan and convert to float here */
424 fetch_texel_2d_rgb_dxt1(texImage
, i
, j
, k
, rgba
);
425 texel
[RCOMP
] = CHAN_TO_FLOAT(rgba
[RCOMP
]);
426 texel
[GCOMP
] = CHAN_TO_FLOAT(rgba
[GCOMP
]);
427 texel
[BCOMP
] = CHAN_TO_FLOAT(rgba
[BCOMP
]);
428 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
433 fetch_texel_2d_rgba_dxt1( const struct gl_texture_image
*texImage
,
434 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
437 if (fetch_ext_rgba_dxt1
) {
438 fetch_ext_rgba_dxt1(texImage
->RowStride
,
439 (GLubyte
*)(texImage
)->Data
, i
, j
, texel
);
442 _mesa_debug(NULL
, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
447 _mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image
*texImage
,
448 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
450 /* just sample as GLchan and convert to float here */
452 fetch_texel_2d_rgba_dxt1(texImage
, i
, j
, k
, rgba
);
453 texel
[RCOMP
] = CHAN_TO_FLOAT(rgba
[RCOMP
]);
454 texel
[GCOMP
] = CHAN_TO_FLOAT(rgba
[GCOMP
]);
455 texel
[BCOMP
] = CHAN_TO_FLOAT(rgba
[BCOMP
]);
456 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
461 fetch_texel_2d_rgba_dxt3( const struct gl_texture_image
*texImage
,
462 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
465 if (fetch_ext_rgba_dxt3
) {
466 ASSERT (sizeof(GLchan
) == sizeof(GLubyte
));
467 fetch_ext_rgba_dxt3(texImage
->RowStride
, (GLubyte
*)(texImage
)->Data
,
471 _mesa_debug(NULL
, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n");
476 _mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image
*texImage
,
477 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
479 /* just sample as GLchan and convert to float here */
481 fetch_texel_2d_rgba_dxt3(texImage
, i
, j
, k
, rgba
);
482 texel
[RCOMP
] = CHAN_TO_FLOAT(rgba
[RCOMP
]);
483 texel
[GCOMP
] = CHAN_TO_FLOAT(rgba
[GCOMP
]);
484 texel
[BCOMP
] = CHAN_TO_FLOAT(rgba
[BCOMP
]);
485 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
490 fetch_texel_2d_rgba_dxt5( const struct gl_texture_image
*texImage
,
491 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
494 if (fetch_ext_rgba_dxt5
) {
495 fetch_ext_rgba_dxt5(texImage
->RowStride
, (GLubyte
*)(texImage
)->Data
,
499 _mesa_debug(NULL
, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n");
504 _mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image
*texImage
,
505 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
507 /* just sample as GLchan and convert to float here */
509 fetch_texel_2d_rgba_dxt5(texImage
, i
, j
, k
, rgba
);
510 texel
[RCOMP
] = CHAN_TO_FLOAT(rgba
[RCOMP
]);
511 texel
[GCOMP
] = CHAN_TO_FLOAT(rgba
[GCOMP
]);
512 texel
[BCOMP
] = CHAN_TO_FLOAT(rgba
[BCOMP
]);
513 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
516 #if FEATURE_EXT_texture_sRGB
518 _mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image
*texImage
,
519 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
521 /* just sample as GLchan and convert to float here */
523 fetch_texel_2d_rgb_dxt1(texImage
, i
, j
, k
, rgba
);
524 texel
[RCOMP
] = nonlinear_to_linear(rgba
[RCOMP
]);
525 texel
[GCOMP
] = nonlinear_to_linear(rgba
[GCOMP
]);
526 texel
[BCOMP
] = nonlinear_to_linear(rgba
[BCOMP
]);
527 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
531 _mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image
*texImage
,
532 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
534 /* just sample as GLchan and convert to float here */
536 fetch_texel_2d_rgba_dxt1(texImage
, i
, j
, k
, rgba
);
537 texel
[RCOMP
] = nonlinear_to_linear(rgba
[RCOMP
]);
538 texel
[GCOMP
] = nonlinear_to_linear(rgba
[GCOMP
]);
539 texel
[BCOMP
] = nonlinear_to_linear(rgba
[BCOMP
]);
540 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
544 _mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image
*texImage
,
545 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
547 /* just sample as GLchan and convert to float here */
549 fetch_texel_2d_rgba_dxt3(texImage
, i
, j
, k
, rgba
);
550 texel
[RCOMP
] = nonlinear_to_linear(rgba
[RCOMP
]);
551 texel
[GCOMP
] = nonlinear_to_linear(rgba
[GCOMP
]);
552 texel
[BCOMP
] = nonlinear_to_linear(rgba
[BCOMP
]);
553 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
557 _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image
*texImage
,
558 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
560 /* just sample as GLchan and convert to float here */
562 fetch_texel_2d_rgba_dxt5(texImage
, i
, j
, k
, rgba
);
563 texel
[RCOMP
] = nonlinear_to_linear(rgba
[RCOMP
]);
564 texel
[GCOMP
] = nonlinear_to_linear(rgba
[GCOMP
]);
565 texel
[BCOMP
] = nonlinear_to_linear(rgba
[BCOMP
]);
566 texel
[ACOMP
] = CHAN_TO_FLOAT(rgba
[ACOMP
]);
570 const struct gl_texture_format _mesa_texformat_rgb_dxt1
= {
571 MESA_FORMAT_RGB_DXT1
, /* MesaFormat */
572 GL_RGB
, /* BaseFormat */
573 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
574 4, /*approx*/ /* RedBits */
575 4, /*approx*/ /* GreenBits */
576 4, /*approx*/ /* BlueBits */
578 0, /* LuminanceBits */
579 0, /* IntensityBits */
586 const struct gl_texture_format _mesa_texformat_rgba_dxt1
= {
587 MESA_FORMAT_RGBA_DXT1
, /* MesaFormat */
588 GL_RGBA
, /* BaseFormat */
589 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
590 4, /*approx*/ /* RedBits */
591 4, /*approx*/ /* GreenBits */
592 4, /*approx*/ /* BlueBits */
593 1, /*approx*/ /* AlphaBits */
594 0, /* LuminanceBits */
595 0, /* IntensityBits */
602 const struct gl_texture_format _mesa_texformat_rgba_dxt3
= {
603 MESA_FORMAT_RGBA_DXT3
, /* MesaFormat */
604 GL_RGBA
, /* BaseFormat */
605 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
606 4, /*approx*/ /* RedBits */
607 4, /*approx*/ /* GreenBits */
608 4, /*approx*/ /* BlueBits */
609 4, /*approx*/ /* AlphaBits */
610 0, /* LuminanceBits */
611 0, /* IntensityBits */
618 const struct gl_texture_format _mesa_texformat_rgba_dxt5
= {
619 MESA_FORMAT_RGBA_DXT5
, /* MesaFormat */
620 GL_RGBA
, /* BaseFormat */
621 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
622 4,/*approx*/ /* RedBits */
623 4,/*approx*/ /* GreenBits */
624 4,/*approx*/ /* BlueBits */
625 4,/*approx*/ /* AlphaBits */
626 0, /* LuminanceBits */
627 0, /* IntensityBits */
634 #if FEATURE_EXT_texture_sRGB
635 const struct gl_texture_format _mesa_texformat_srgb_dxt1
= {
636 MESA_FORMAT_SRGB_DXT1
, /* MesaFormat */
637 GL_RGB
, /* BaseFormat */
638 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
639 4, /*approx*/ /* RedBits */
640 4, /*approx*/ /* GreenBits */
641 4, /*approx*/ /* BlueBits */
643 0, /* LuminanceBits */
644 0, /* IntensityBits */
651 const struct gl_texture_format _mesa_texformat_srgba_dxt1
= {
652 MESA_FORMAT_SRGBA_DXT1
, /* MesaFormat */
653 GL_RGBA
, /* BaseFormat */
654 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
655 4, /*approx*/ /* RedBits */
656 4, /*approx*/ /* GreenBits */
657 4, /*approx*/ /* BlueBits */
658 1, /*approx*/ /* AlphaBits */
659 0, /* LuminanceBits */
660 0, /* IntensityBits */
667 const struct gl_texture_format _mesa_texformat_srgba_dxt3
= {
668 MESA_FORMAT_SRGBA_DXT3
, /* MesaFormat */
669 GL_RGBA
, /* BaseFormat */
670 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
671 4, /*approx*/ /* RedBits */
672 4, /*approx*/ /* GreenBits */
673 4, /*approx*/ /* BlueBits */
674 4, /*approx*/ /* AlphaBits */
675 0, /* LuminanceBits */
676 0, /* IntensityBits */
683 const struct gl_texture_format _mesa_texformat_srgba_dxt5
= {
684 MESA_FORMAT_SRGBA_DXT5
, /* MesaFormat */
685 GL_RGBA
, /* BaseFormat */
686 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
687 4,/*approx*/ /* RedBits */
688 4,/*approx*/ /* GreenBits */
689 4,/*approx*/ /* BlueBits */
690 4,/*approx*/ /* AlphaBits */
691 0, /* LuminanceBits */
692 0, /* IntensityBits */