added dstRowStride to dxtCompressTexFuncExt;
[mesa.git] / src / mesa / main / texcompress_s3tc.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.1
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file texcompress_s3tc.c
28 * GL_EXT_texture_compression_s3tc support.
29 */
30
31 #ifndef USE_EXTERNAL_DXTN_LIB
32 #define USE_EXTERNAL_DXTN_LIB 0
33 #endif
34
35 #include "glheader.h"
36 #include "imports.h"
37 #include "colormac.h"
38 #include "context.h"
39 #include "convolve.h"
40 #include "image.h"
41 #include "texcompress.h"
42 #include "texformat.h"
43 #include "texstore.h"
44
45 #if USE_EXTERNAL_DXTN_LIB
46 #ifdef __MINGW32__
47 /* no dlopen */
48 #define DXTN_EXT "dxtn.dll"
49 #define DXTN_PREFIX ""
50 #define dlopen(name, mode) LoadLibrary(name)
51 #define dlsym(hndl, proc) GetProcAddress(hndl, proc)
52 #define dlclose(hndl) FreeLibrary(hndl)
53 #elif defined(__DJGPP__)
54 /* has dlopen, but doesn't like the names */
55 #include <dlfcn.h>
56 #define DXTN_EXT "dxtn.dxe"
57 #define DXTN_PREFIX "_"
58 #else
59 /* happiness */
60 #include <dlfcn.h>
61 #define DXTN_EXT "libtxc_dxtn.so"
62 #define DXTN_PREFIX ""
63 #endif
64 #endif /* USE_EXTERNAL_DXTN_LIB */
65
66 typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut );
67 dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL;
68 dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL;
69 dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL;
70 dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL;
71
72 typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destformat, GLubyte *dest, GLint dstRowStride);
73 dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL;
74
75 void *dxtlibhandle = NULL;
76
77 void
78 _mesa_init_texture_s3tc( GLcontext *ctx )
79 {
80 /* called during context initialization */
81 ctx->Mesa_DXTn = GL_FALSE;
82 #if USE_EXTERNAL_DXTN_LIB
83 if (!dxtlibhandle) {
84 dxtlibhandle = dlopen (DXTN_EXT, RTLD_LAZY | RTLD_GLOBAL);
85 if (!dxtlibhandle) {
86 _mesa_warning(ctx, "couldn't open " DXTN_EXT ", software DXTn "
87 "compression/decompression unavailable\n");
88 }
89 else {
90 /* the fetch functions are not per context! Might be problematic... */
91 fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgb_dxt1");
92 if (fetch_ext_rgb_dxt1 != NULL) {
93 fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt1");
94 }
95 if (fetch_ext_rgba_dxt1 != NULL) {
96 fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt3");
97 }
98 if (fetch_ext_rgba_dxt3 != NULL) {
99 fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt5");
100 }
101 if (fetch_ext_rgba_dxt5 != NULL) {
102 ext_tx_compress_dxtn = (dxtCompressTexFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "tx_compress_dxtn");
103 }
104
105 if (ext_tx_compress_dxtn == NULL) {
106 _mesa_warning(ctx, "couldn't reference all symbols in "
107 DXTN_EXT ", software DXTn compression/decompression "
108 "unavailable\n");
109 fetch_ext_rgb_dxt1 = NULL;
110 fetch_ext_rgba_dxt1 = NULL;
111 fetch_ext_rgba_dxt3 = NULL;
112 fetch_ext_rgba_dxt5 = NULL;
113 ext_tx_compress_dxtn = NULL;
114 dlclose(dxtlibhandle);
115 dxtlibhandle = NULL;
116 }
117 }
118 }
119 if (dxtlibhandle) {
120 ctx->Mesa_DXTn = GL_TRUE;
121 _mesa_warning(ctx, "software DXTn compression/decompression available\n");
122 }
123 #else
124 (void) ctx;
125 #endif
126 }
127
128 /**
129 * Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
130 */
131 static GLboolean
132 texstore_rgb_dxt1(STORE_PARAMS)
133 {
134 const GLchan *pixels;
135 GLint srcRowStride;
136 GLubyte *dst;
137 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
138 const GLchan *tempImage = NULL;
139
140 ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1);
141 ASSERT(dstXoffset % 4 == 0);
142 ASSERT(dstYoffset % 4 == 0);
143 ASSERT(dstZoffset % 4 == 0);
144 (void) dstZoffset; (void) dstImageStride;
145
146 if (srcFormat != GL_RGB ||
147 srcType != CHAN_TYPE ||
148 ctx->_ImageTransferState ||
149 srcPacking->SwapBytes) {
150 /* convert image to RGB/GLchan */
151 tempImage = _mesa_make_temp_chan_image(ctx, dims,
152 baseInternalFormat,
153 dstFormat->BaseFormat,
154 srcWidth, srcHeight, srcDepth,
155 srcFormat, srcType, srcAddr,
156 srcPacking);
157 if (!tempImage)
158 return GL_FALSE; /* out of memory */
159 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
160 pixels = tempImage;
161 srcRowStride = 3 * srcWidth;
162 srcFormat = GL_RGB;
163 }
164 else {
165 pixels = (const GLchan *) srcAddr;
166 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
167 srcType) / sizeof(GLchan);
168 }
169
170 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
171 GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
172 texWidth, (GLubyte *) dstAddr);
173
174 if (ext_tx_compress_dxtn) {
175 (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst, dstRowStride);
176 }
177 else {
178 _mesa_problem(ctx, "external dxt library not available");
179 }
180
181 if (tempImage)
182 _mesa_free((void *) tempImage);
183
184 return GL_TRUE;
185 }
186
187
188 /**
189 * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
190 */
191 static GLboolean
192 texstore_rgba_dxt1(STORE_PARAMS)
193 {
194 const GLchan *pixels;
195 GLint srcRowStride;
196 GLubyte *dst;
197 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
198 const GLchan *tempImage = NULL;
199
200 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1);
201 ASSERT(dstXoffset % 4 == 0);
202 ASSERT(dstYoffset % 4 == 0);
203 ASSERT(dstZoffset % 4 == 0);
204 (void) dstZoffset; (void) dstImageStride;
205
206 if (srcFormat != GL_RGBA ||
207 srcType != CHAN_TYPE ||
208 ctx->_ImageTransferState ||
209 srcPacking->SwapBytes) {
210 /* convert image to RGBA/GLchan */
211 tempImage = _mesa_make_temp_chan_image(ctx, dims,
212 baseInternalFormat,
213 dstFormat->BaseFormat,
214 srcWidth, srcHeight, srcDepth,
215 srcFormat, srcType, srcAddr,
216 srcPacking);
217 if (!tempImage)
218 return GL_FALSE; /* out of memory */
219 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
220 pixels = tempImage;
221 srcRowStride = 4 * srcWidth;
222 srcFormat = GL_RGBA;
223 }
224 else {
225 pixels = (const GLchan *) srcAddr;
226 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
227 srcType) / sizeof(GLchan);
228 }
229
230 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
231 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
232 texWidth, (GLubyte *) dstAddr);
233 if (ext_tx_compress_dxtn) {
234 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst, dstRowStride);
235 }
236 else {
237 _mesa_problem(ctx, "external dxt library not available");
238 }
239
240 if (tempImage)
241 _mesa_free((void*) tempImage);
242
243 return GL_TRUE;
244 }
245
246
247 /**
248 * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
249 */
250 static GLboolean
251 texstore_rgba_dxt3(STORE_PARAMS)
252 {
253 const GLchan *pixels;
254 GLint srcRowStride;
255 GLubyte *dst;
256 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
257 const GLchan *tempImage = NULL;
258
259 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3);
260 ASSERT(dstXoffset % 4 == 0);
261 ASSERT(dstYoffset % 4 == 0);
262 ASSERT(dstZoffset % 4 == 0);
263 (void) dstZoffset; (void) dstImageStride;
264
265 if (srcFormat != GL_RGBA ||
266 srcType != CHAN_TYPE ||
267 ctx->_ImageTransferState ||
268 srcPacking->SwapBytes) {
269 /* convert image to RGBA/GLchan */
270 tempImage = _mesa_make_temp_chan_image(ctx, dims,
271 baseInternalFormat,
272 dstFormat->BaseFormat,
273 srcWidth, srcHeight, srcDepth,
274 srcFormat, srcType, srcAddr,
275 srcPacking);
276 if (!tempImage)
277 return GL_FALSE; /* out of memory */
278 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
279 pixels = tempImage;
280 srcRowStride = 4 * srcWidth;
281 }
282 else {
283 pixels = (const GLchan *) srcAddr;
284 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
285 srcType) / sizeof(GLchan);
286 }
287
288 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
289 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
290 texWidth, (GLubyte *) dstAddr);
291 if (ext_tx_compress_dxtn) {
292 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst, dstRowStride);
293 }
294 else {
295 _mesa_problem(ctx, "external dxt library not available");
296 }
297
298 if (tempImage)
299 _mesa_free((void *) tempImage);
300
301 return GL_TRUE;
302 }
303
304
305 /**
306 * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
307 */
308 static GLboolean
309 texstore_rgba_dxt5(STORE_PARAMS)
310 {
311 const GLchan *pixels;
312 GLint srcRowStride;
313 GLubyte *dst;
314 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
315 const GLchan *tempImage = NULL;
316
317 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5);
318 ASSERT(dstXoffset % 4 == 0);
319 ASSERT(dstYoffset % 4 == 0);
320 ASSERT(dstZoffset % 4 == 0);
321 (void) dstZoffset; (void) dstImageStride;
322
323 if (srcFormat != GL_RGBA ||
324 srcType != CHAN_TYPE ||
325 ctx->_ImageTransferState ||
326 srcPacking->SwapBytes) {
327 /* convert image to RGBA/GLchan */
328 tempImage = _mesa_make_temp_chan_image(ctx, dims,
329 baseInternalFormat,
330 dstFormat->BaseFormat,
331 srcWidth, srcHeight, srcDepth,
332 srcFormat, srcType, srcAddr,
333 srcPacking);
334 if (!tempImage)
335 return GL_FALSE; /* out of memory */
336 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
337 pixels = tempImage;
338 srcRowStride = 4 * srcWidth;
339 }
340 else {
341 pixels = (const GLchan *) srcAddr;
342 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
343 srcType) / sizeof(GLchan);
344 }
345
346 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
347 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
348 texWidth, (GLubyte *) dstAddr);
349 if (ext_tx_compress_dxtn) {
350 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst, dstRowStride);
351 }
352 else {
353 _mesa_problem(ctx, "external dxt library not available");
354 }
355
356 if (tempImage)
357 _mesa_free((void *) tempImage);
358
359 return GL_TRUE;
360 }
361
362
363 static void
364 fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
365 GLint i, GLint j, GLint k, GLchan *texel )
366 {
367 (void) k;
368 if (fetch_ext_rgb_dxt1) {
369 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
370 (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
371 }
372 else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
373 }
374
375
376 static void
377 fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
378 GLint i, GLint j, GLint k, GLfloat *texel )
379 {
380 /* just sample as GLchan and convert to float here */
381 GLchan rgba[4];
382 fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
383 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
384 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
385 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
386 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
387 }
388
389
390 static void
391 fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
392 GLint i, GLint j, GLint k, GLchan *texel )
393 {
394 (void) k;
395 if (fetch_ext_rgba_dxt1) {
396 (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
397 }
398 else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
399 }
400
401
402 static void
403 fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
404 GLint i, GLint j, GLint k, GLfloat *texel )
405 {
406 /* just sample as GLchan and convert to float here */
407 GLchan rgba[4];
408 fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
409 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
410 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
411 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
412 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
413 }
414
415
416 static void
417 fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
418 GLint i, GLint j, GLint k, GLchan *texel )
419 {
420 (void) k;
421 if (fetch_ext_rgba_dxt3) {
422 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
423 (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
424 }
425 else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
426 }
427
428
429 static void
430 fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
431 GLint i, GLint j, GLint k, GLfloat *texel )
432 {
433 /* just sample as GLchan and convert to float here */
434 GLchan rgba[4];
435 fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
436 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
437 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
438 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
439 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
440 }
441
442
443 static void
444 fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
445 GLint i, GLint j, GLint k, GLchan *texel )
446 {
447 (void) k;
448 if (fetch_ext_rgba_dxt5) {
449 (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
450 }
451 else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
452 }
453
454
455 static void
456 fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
457 GLint i, GLint j, GLint k, GLfloat *texel )
458 {
459 /* just sample as GLchan and convert to float here */
460 GLchan rgba[4];
461 fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
462 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
463 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
464 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
465 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
466 }
467
468
469 const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
470 MESA_FORMAT_RGB_DXT1, /* MesaFormat */
471 GL_RGB, /* BaseFormat */
472 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
473 4, /*approx*/ /* RedBits */
474 4, /*approx*/ /* GreenBits */
475 4, /*approx*/ /* BlueBits */
476 0, /* AlphaBits */
477 0, /* LuminanceBits */
478 0, /* IntensityBits */
479 0, /* IndexBits */
480 0, /* DepthBits */
481 0, /* TexelBytes */
482 texstore_rgb_dxt1, /* StoreTexImageFunc */
483 NULL, /*impossible*/ /* FetchTexel1D */
484 fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
485 NULL, /*impossible*/ /* FetchTexel3D */
486 NULL, /*impossible*/ /* FetchTexel1Df */
487 fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
488 NULL, /*impossible*/ /* FetchTexel3Df */
489 };
490
491 const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
492 MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
493 GL_RGBA, /* BaseFormat */
494 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
495 4, /*approx*/ /* RedBits */
496 4, /*approx*/ /* GreenBits */
497 4, /*approx*/ /* BlueBits */
498 1, /*approx*/ /* AlphaBits */
499 0, /* LuminanceBits */
500 0, /* IntensityBits */
501 0, /* IndexBits */
502 0, /* DepthBits */
503 0, /* TexelBytes */
504 texstore_rgba_dxt1, /* StoreTexImageFunc */
505 NULL, /*impossible*/ /* FetchTexel1D */
506 fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
507 NULL, /*impossible*/ /* FetchTexel3D */
508 NULL, /*impossible*/ /* FetchTexel1Df */
509 fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
510 NULL, /*impossible*/ /* FetchTexel3Df */
511 };
512
513 const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
514 MESA_FORMAT_RGBA_DXT3, /* MesaFormat */
515 GL_RGBA, /* BaseFormat */
516 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
517 4, /*approx*/ /* RedBits */
518 4, /*approx*/ /* GreenBits */
519 4, /*approx*/ /* BlueBits */
520 4, /*approx*/ /* AlphaBits */
521 0, /* LuminanceBits */
522 0, /* IntensityBits */
523 0, /* IndexBits */
524 0, /* DepthBits */
525 0, /* TexelBytes */
526 texstore_rgba_dxt3, /* StoreTexImageFunc */
527 NULL, /*impossible*/ /* FetchTexel1D */
528 fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
529 NULL, /*impossible*/ /* FetchTexel3D */
530 NULL, /*impossible*/ /* FetchTexel1Df */
531 fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
532 NULL, /*impossible*/ /* FetchTexel3Df */
533 };
534
535 const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
536 MESA_FORMAT_RGBA_DXT5, /* MesaFormat */
537 GL_RGBA, /* BaseFormat */
538 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
539 4,/*approx*/ /* RedBits */
540 4,/*approx*/ /* GreenBits */
541 4,/*approx*/ /* BlueBits */
542 4,/*approx*/ /* AlphaBits */
543 0, /* LuminanceBits */
544 0, /* IntensityBits */
545 0, /* IndexBits */
546 0, /* DepthBits */
547 0, /* TexelBytes */
548 texstore_rgba_dxt5, /* StoreTexImageFunc */
549 NULL, /*impossible*/ /* FetchTexel1D */
550 fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
551 NULL, /*impossible*/ /* FetchTexel3D */
552 NULL, /*impossible*/ /* FetchTexel1Df */
553 fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
554 NULL, /*impossible*/ /* FetchTexel3Df */
555 };