In gl_texture_image, replace ImageStride with an ImageOffsets array.
[mesa.git] / src / mesa / main / texcompress_s3tc.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 1999-2005 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,
73 GLint height, const GLchan *srcPixData,
74 GLenum destformat, GLubyte *dest,
75 GLint dstRowStride);
76 static dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL;
77
78 static void *dxtlibhandle = NULL;
79
80
81 void
82 _mesa_init_texture_s3tc( GLcontext *ctx )
83 {
84 /* called during context initialization */
85 ctx->Mesa_DXTn = GL_FALSE;
86 #if USE_EXTERNAL_DXTN_LIB
87 if (!dxtlibhandle) {
88 dxtlibhandle = dlopen (DXTN_EXT, RTLD_LAZY | RTLD_GLOBAL);
89 if (!dxtlibhandle) {
90 _mesa_warning(ctx, "couldn't open " DXTN_EXT ", software DXTn "
91 "compression/decompression unavailable");
92 }
93 else {
94 /* the fetch functions are not per context! Might be problematic... */
95 fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgb_dxt1");
96 if (fetch_ext_rgb_dxt1 != NULL) {
97 fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt1");
98 }
99 if (fetch_ext_rgba_dxt1 != NULL) {
100 fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt3");
101 }
102 if (fetch_ext_rgba_dxt3 != NULL) {
103 fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt5");
104 }
105 if (fetch_ext_rgba_dxt5 != NULL) {
106 ext_tx_compress_dxtn = (dxtCompressTexFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "tx_compress_dxtn");
107 }
108
109 if (ext_tx_compress_dxtn == NULL) {
110 _mesa_warning(ctx, "couldn't reference all symbols in "
111 DXTN_EXT ", software DXTn compression/decompression "
112 "unavailable");
113 fetch_ext_rgb_dxt1 = NULL;
114 fetch_ext_rgba_dxt1 = NULL;
115 fetch_ext_rgba_dxt3 = NULL;
116 fetch_ext_rgba_dxt5 = NULL;
117 ext_tx_compress_dxtn = NULL;
118 dlclose(dxtlibhandle);
119 dxtlibhandle = NULL;
120 }
121 }
122 }
123 if (dxtlibhandle) {
124 ctx->Mesa_DXTn = GL_TRUE;
125 _mesa_warning(ctx, "software DXTn compression/decompression available");
126 }
127 #else
128 (void) ctx;
129 #endif
130 }
131
132 /**
133 * Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
134 */
135 static GLboolean
136 texstore_rgb_dxt1(TEXSTORE_PARAMS)
137 {
138 const GLchan *pixels;
139 GLint srcRowStride;
140 GLubyte *dst;
141 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
142 const GLchan *tempImage = NULL;
143
144 ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1);
145 ASSERT(dstXoffset % 4 == 0);
146 ASSERT(dstYoffset % 4 == 0);
147 ASSERT(dstZoffset % 4 == 0);
148 (void) dstZoffset;
149 (void) dstImageOffsets;
150
151 if (srcFormat != GL_RGB ||
152 srcType != CHAN_TYPE ||
153 ctx->_ImageTransferState ||
154 srcPacking->SwapBytes) {
155 /* convert image to RGB/GLchan */
156 tempImage = _mesa_make_temp_chan_image(ctx, dims,
157 baseInternalFormat,
158 dstFormat->BaseFormat,
159 srcWidth, srcHeight, srcDepth,
160 srcFormat, srcType, srcAddr,
161 srcPacking);
162 if (!tempImage)
163 return GL_FALSE; /* out of memory */
164 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
165 pixels = tempImage;
166 srcRowStride = 3 * srcWidth;
167 srcFormat = GL_RGB;
168 }
169 else {
170 pixels = (const GLchan *) srcAddr;
171 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
172 srcType) / sizeof(GLchan);
173 }
174
175 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
176 dstFormat->MesaFormat,
177 texWidth, (GLubyte *) dstAddr);
178
179 if (ext_tx_compress_dxtn) {
180 (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
181 GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
182 dst, dstRowStride);
183 }
184 else {
185 _mesa_problem(ctx, "external dxt library not available");
186 }
187
188 if (tempImage)
189 _mesa_free((void *) tempImage);
190
191 return GL_TRUE;
192 }
193
194
195 /**
196 * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
197 */
198 static GLboolean
199 texstore_rgba_dxt1(TEXSTORE_PARAMS)
200 {
201 const GLchan *pixels;
202 GLint srcRowStride;
203 GLubyte *dst;
204 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
205 const GLchan *tempImage = NULL;
206
207 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1);
208 ASSERT(dstXoffset % 4 == 0);
209 ASSERT(dstYoffset % 4 == 0);
210 ASSERT(dstZoffset % 4 == 0);
211 (void) dstZoffset;
212 (void) dstImageOffsets;
213
214 if (srcFormat != GL_RGBA ||
215 srcType != CHAN_TYPE ||
216 ctx->_ImageTransferState ||
217 srcPacking->SwapBytes) {
218 /* convert image to RGBA/GLchan */
219 tempImage = _mesa_make_temp_chan_image(ctx, dims,
220 baseInternalFormat,
221 dstFormat->BaseFormat,
222 srcWidth, srcHeight, srcDepth,
223 srcFormat, srcType, srcAddr,
224 srcPacking);
225 if (!tempImage)
226 return GL_FALSE; /* out of memory */
227 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
228 pixels = tempImage;
229 srcRowStride = 4 * srcWidth;
230 srcFormat = GL_RGBA;
231 }
232 else {
233 pixels = (const GLchan *) srcAddr;
234 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
235 srcType) / sizeof(GLchan);
236 }
237
238 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
239 dstFormat->MesaFormat,
240 texWidth, (GLubyte *) dstAddr);
241 if (ext_tx_compress_dxtn) {
242 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
243 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
244 dst, dstRowStride);
245 }
246 else {
247 _mesa_problem(ctx, "external dxt library not available");
248 }
249
250 if (tempImage)
251 _mesa_free((void*) tempImage);
252
253 return GL_TRUE;
254 }
255
256
257 /**
258 * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
259 */
260 static GLboolean
261 texstore_rgba_dxt3(TEXSTORE_PARAMS)
262 {
263 const GLchan *pixels;
264 GLint srcRowStride;
265 GLubyte *dst;
266 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
267 const GLchan *tempImage = NULL;
268
269 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3);
270 ASSERT(dstXoffset % 4 == 0);
271 ASSERT(dstYoffset % 4 == 0);
272 ASSERT(dstZoffset % 4 == 0);
273 (void) dstZoffset;
274 (void) dstImageOffsets;
275
276 if (srcFormat != GL_RGBA ||
277 srcType != CHAN_TYPE ||
278 ctx->_ImageTransferState ||
279 srcPacking->SwapBytes) {
280 /* convert image to RGBA/GLchan */
281 tempImage = _mesa_make_temp_chan_image(ctx, dims,
282 baseInternalFormat,
283 dstFormat->BaseFormat,
284 srcWidth, srcHeight, srcDepth,
285 srcFormat, srcType, srcAddr,
286 srcPacking);
287 if (!tempImage)
288 return GL_FALSE; /* out of memory */
289 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
290 pixels = tempImage;
291 srcRowStride = 4 * srcWidth;
292 }
293 else {
294 pixels = (const GLchan *) srcAddr;
295 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
296 srcType) / sizeof(GLchan);
297 }
298
299 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
300 dstFormat->MesaFormat,
301 texWidth, (GLubyte *) dstAddr);
302 if (ext_tx_compress_dxtn) {
303 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
304 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
305 dst, dstRowStride);
306 }
307 else {
308 _mesa_problem(ctx, "external dxt library not available");
309 }
310
311 if (tempImage)
312 _mesa_free((void *) tempImage);
313
314 return GL_TRUE;
315 }
316
317
318 /**
319 * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
320 */
321 static GLboolean
322 texstore_rgba_dxt5(TEXSTORE_PARAMS)
323 {
324 const GLchan *pixels;
325 GLint srcRowStride;
326 GLubyte *dst;
327 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
328 const GLchan *tempImage = NULL;
329
330 ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5);
331 ASSERT(dstXoffset % 4 == 0);
332 ASSERT(dstYoffset % 4 == 0);
333 ASSERT(dstZoffset % 4 == 0);
334 (void) dstZoffset;
335 (void) dstImageOffsets;
336
337 if (srcFormat != GL_RGBA ||
338 srcType != CHAN_TYPE ||
339 ctx->_ImageTransferState ||
340 srcPacking->SwapBytes) {
341 /* convert image to RGBA/GLchan */
342 tempImage = _mesa_make_temp_chan_image(ctx, dims,
343 baseInternalFormat,
344 dstFormat->BaseFormat,
345 srcWidth, srcHeight, srcDepth,
346 srcFormat, srcType, srcAddr,
347 srcPacking);
348 if (!tempImage)
349 return GL_FALSE; /* out of memory */
350 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
351 pixels = tempImage;
352 srcRowStride = 4 * srcWidth;
353 }
354 else {
355 pixels = (const GLchan *) srcAddr;
356 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
357 srcType) / sizeof(GLchan);
358 }
359
360 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
361 dstFormat->MesaFormat,
362 texWidth, (GLubyte *) dstAddr);
363 if (ext_tx_compress_dxtn) {
364 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
365 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
366 dst, dstRowStride);
367 }
368 else {
369 _mesa_problem(ctx, "external dxt library not available");
370 }
371
372 if (tempImage)
373 _mesa_free((void *) tempImage);
374
375 return GL_TRUE;
376 }
377
378
379 static void
380 fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
381 GLint i, GLint j, GLint k, GLchan *texel )
382 {
383 (void) k;
384 if (fetch_ext_rgb_dxt1) {
385 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
386 fetch_ext_rgb_dxt1(texImage->RowStride,
387 (GLubyte *)(texImage)->Data, i, j, texel);
388 }
389 else
390 _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
391 }
392
393
394 static void
395 fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
396 GLint i, GLint j, GLint k, GLfloat *texel )
397 {
398 /* just sample as GLchan and convert to float here */
399 GLchan rgba[4];
400 fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
401 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
402 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
403 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
404 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
405 }
406
407
408 static void
409 fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
410 GLint i, GLint j, GLint k, GLchan *texel )
411 {
412 (void) k;
413 if (fetch_ext_rgba_dxt1) {
414 fetch_ext_rgba_dxt1(texImage->RowStride,
415 (GLubyte *)(texImage)->Data, i, j, texel);
416 }
417 else
418 _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
419 }
420
421
422 static void
423 fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
424 GLint i, GLint j, GLint k, GLfloat *texel )
425 {
426 /* just sample as GLchan and convert to float here */
427 GLchan rgba[4];
428 fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
429 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
430 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
431 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
432 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
433 }
434
435
436 static void
437 fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
438 GLint i, GLint j, GLint k, GLchan *texel )
439 {
440 (void) k;
441 if (fetch_ext_rgba_dxt3) {
442 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
443 fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
444 i, j, texel);
445 }
446 else
447 _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
448 }
449
450
451 static void
452 fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
453 GLint i, GLint j, GLint k, GLfloat *texel )
454 {
455 /* just sample as GLchan and convert to float here */
456 GLchan rgba[4];
457 fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
458 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
459 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
460 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
461 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
462 }
463
464
465 static void
466 fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
467 GLint i, GLint j, GLint k, GLchan *texel )
468 {
469 (void) k;
470 if (fetch_ext_rgba_dxt5) {
471 fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
472 i, j, texel);
473 }
474 else
475 _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
476 }
477
478
479 static void
480 fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
481 GLint i, GLint j, GLint k, GLfloat *texel )
482 {
483 /* just sample as GLchan and convert to float here */
484 GLchan rgba[4];
485 fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
486 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
487 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
488 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
489 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
490 }
491
492
493 const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
494 MESA_FORMAT_RGB_DXT1, /* MesaFormat */
495 GL_RGB, /* BaseFormat */
496 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
497 4, /*approx*/ /* RedBits */
498 4, /*approx*/ /* GreenBits */
499 4, /*approx*/ /* BlueBits */
500 0, /* AlphaBits */
501 0, /* LuminanceBits */
502 0, /* IntensityBits */
503 0, /* IndexBits */
504 0, /* DepthBits */
505 0, /* StencilBits */
506 0, /* TexelBytes */
507 texstore_rgb_dxt1, /* StoreTexImageFunc */
508 NULL, /*impossible*/ /* FetchTexel1D */
509 fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
510 NULL, /*impossible*/ /* FetchTexel3D */
511 NULL, /*impossible*/ /* FetchTexel1Df */
512 fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
513 NULL, /*impossible*/ /* FetchTexel3Df */
514 NULL /* StoreTexel */
515 };
516
517 const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
518 MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
519 GL_RGBA, /* BaseFormat */
520 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
521 4, /*approx*/ /* RedBits */
522 4, /*approx*/ /* GreenBits */
523 4, /*approx*/ /* BlueBits */
524 1, /*approx*/ /* AlphaBits */
525 0, /* LuminanceBits */
526 0, /* IntensityBits */
527 0, /* IndexBits */
528 0, /* DepthBits */
529 0, /* StencilBits */
530 0, /* TexelBytes */
531 texstore_rgba_dxt1, /* StoreTexImageFunc */
532 NULL, /*impossible*/ /* FetchTexel1D */
533 fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
534 NULL, /*impossible*/ /* FetchTexel3D */
535 NULL, /*impossible*/ /* FetchTexel1Df */
536 fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
537 NULL, /*impossible*/ /* FetchTexel3Df */
538 NULL /* StoreTexel */
539 };
540
541 const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
542 MESA_FORMAT_RGBA_DXT3, /* MesaFormat */
543 GL_RGBA, /* BaseFormat */
544 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
545 4, /*approx*/ /* RedBits */
546 4, /*approx*/ /* GreenBits */
547 4, /*approx*/ /* BlueBits */
548 4, /*approx*/ /* AlphaBits */
549 0, /* LuminanceBits */
550 0, /* IntensityBits */
551 0, /* IndexBits */
552 0, /* DepthBits */
553 0, /* StencilBits */
554 0, /* TexelBytes */
555 texstore_rgba_dxt3, /* StoreTexImageFunc */
556 NULL, /*impossible*/ /* FetchTexel1D */
557 fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
558 NULL, /*impossible*/ /* FetchTexel3D */
559 NULL, /*impossible*/ /* FetchTexel1Df */
560 fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
561 NULL, /*impossible*/ /* FetchTexel3Df */
562 NULL /* StoreTexel */
563 };
564
565 const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
566 MESA_FORMAT_RGBA_DXT5, /* MesaFormat */
567 GL_RGBA, /* BaseFormat */
568 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
569 4,/*approx*/ /* RedBits */
570 4,/*approx*/ /* GreenBits */
571 4,/*approx*/ /* BlueBits */
572 4,/*approx*/ /* AlphaBits */
573 0, /* LuminanceBits */
574 0, /* IntensityBits */
575 0, /* IndexBits */
576 0, /* DepthBits */
577 0, /* StencilBits */
578 0, /* TexelBytes */
579 texstore_rgba_dxt5, /* StoreTexImageFunc */
580 NULL, /*impossible*/ /* FetchTexel1D */
581 fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
582 NULL, /*impossible*/ /* FetchTexel3D */
583 NULL, /*impossible*/ /* FetchTexel1Df */
584 fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
585 NULL, /*impossible*/ /* FetchTexel3Df */
586 NULL /* StoreTexel */
587 };