mesa: don't include texformat.h
[mesa.git] / src / mesa / main / texcompress_s3tc.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5.3
4 *
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
6 * Copyright (c) 2008 VMware, Inc.
7 *
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:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
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.
24 */
25
26
27 /**
28 * \file texcompress_s3tc.c
29 * GL_EXT_texture_compression_s3tc support.
30 */
31
32 #ifndef USE_EXTERNAL_DXTN_LIB
33 #define USE_EXTERNAL_DXTN_LIB 1
34 #endif
35
36 #include "glheader.h"
37 #include "imports.h"
38 #include "colormac.h"
39 #include "context.h"
40 #include "convolve.h"
41 #include "dlopen.h"
42 #include "image.h"
43 #include "texcompress.h"
44 #include "texcompress_s3tc.h"
45 #include "texstore.h"
46
47 #ifdef __MINGW32__
48 #define DXTN_LIBNAME "dxtn.dll"
49 #define RTLD_LAZY 0
50 #define RTLD_GLOBAL 0
51 #elif defined(__DJGPP__)
52 #define DXTN_LIBNAME "dxtn.dxe"
53 #else
54 #define DXTN_LIBNAME "libtxc_dxtn.so"
55 #endif
56
57 #if FEATURE_EXT_texture_sRGB
58 /**
59 * Convert an 8-bit sRGB value from non-linear space to a
60 * linear RGB value in [0, 1].
61 * Implemented with a 256-entry lookup table.
62 */
63 static INLINE GLfloat
64 nonlinear_to_linear(GLubyte cs8)
65 {
66 static GLfloat table[256];
67 static GLboolean tableReady = GL_FALSE;
68 if (!tableReady) {
69 /* compute lookup table now */
70 GLuint i;
71 for (i = 0; i < 256; i++) {
72 const GLfloat cs = UBYTE_TO_FLOAT(i);
73 if (cs <= 0.04045) {
74 table[i] = cs / 12.92f;
75 }
76 else {
77 table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
78 }
79 }
80 tableReady = GL_TRUE;
81 }
82 return table[cs8];
83 }
84 #endif /* FEATURE_EXT_texture_sRGB */
85
86 typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut );
87
88 dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL;
89 dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL;
90 dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL;
91 dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL;
92
93 typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width,
94 GLint height, const GLchan *srcPixData,
95 GLenum destformat, GLubyte *dest,
96 GLint dstRowStride);
97
98 static dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL;
99
100 static void *dxtlibhandle = NULL;
101
102
103 void
104 _mesa_init_texture_s3tc( GLcontext *ctx )
105 {
106 /* called during context initialization */
107 ctx->Mesa_DXTn = GL_FALSE;
108 #if USE_EXTERNAL_DXTN_LIB
109 if (!dxtlibhandle) {
110 dxtlibhandle = _mesa_dlopen(DXTN_LIBNAME, 0);
111 if (!dxtlibhandle) {
112 _mesa_warning(ctx, "couldn't open " DXTN_LIBNAME ", software DXTn "
113 "compression/decompression unavailable");
114 }
115 else {
116 /* the fetch functions are not per context! Might be problematic... */
117 fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)
118 _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgb_dxt1");
119 fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)
120 _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt1");
121 fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)
122 _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt3");
123 fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)
124 _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt5");
125 ext_tx_compress_dxtn = (dxtCompressTexFuncExt)
126 _mesa_dlsym(dxtlibhandle, "tx_compress_dxtn");
127
128 if (!fetch_ext_rgb_dxt1 ||
129 !fetch_ext_rgba_dxt1 ||
130 !fetch_ext_rgba_dxt3 ||
131 !fetch_ext_rgba_dxt5 ||
132 !ext_tx_compress_dxtn) {
133 _mesa_warning(ctx, "couldn't reference all symbols in "
134 DXTN_LIBNAME ", software DXTn compression/decompression "
135 "unavailable");
136 fetch_ext_rgb_dxt1 = NULL;
137 fetch_ext_rgba_dxt1 = NULL;
138 fetch_ext_rgba_dxt3 = NULL;
139 fetch_ext_rgba_dxt5 = NULL;
140 ext_tx_compress_dxtn = NULL;
141 _mesa_dlclose(dxtlibhandle);
142 dxtlibhandle = NULL;
143 }
144 }
145 }
146 if (dxtlibhandle) {
147 ctx->Mesa_DXTn = GL_TRUE;
148 _mesa_warning(ctx, "software DXTn compression/decompression available");
149 }
150 #else
151 (void) ctx;
152 #endif
153 }
154
155 /**
156 * Store user's image in rgb_dxt1 format.
157 */
158 GLboolean
159 _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
160 {
161 const GLchan *pixels;
162 GLint srcRowStride;
163 GLubyte *dst;
164 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
165 const GLchan *tempImage = NULL;
166
167 ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1);
168 ASSERT(dstXoffset % 4 == 0);
169 ASSERT(dstYoffset % 4 == 0);
170 ASSERT(dstZoffset % 4 == 0);
171 (void) dstZoffset;
172 (void) dstImageOffsets;
173
174 if (srcFormat != GL_RGB ||
175 srcType != CHAN_TYPE ||
176 ctx->_ImageTransferState ||
177 srcPacking->SwapBytes) {
178 /* convert image to RGB/GLchan */
179 tempImage = _mesa_make_temp_chan_image(ctx, dims,
180 baseInternalFormat,
181 _mesa_get_format_base_format(dstFormat),
182 srcWidth, srcHeight, srcDepth,
183 srcFormat, srcType, srcAddr,
184 srcPacking);
185 if (!tempImage)
186 return GL_FALSE; /* out of memory */
187 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
188 pixels = tempImage;
189 srcRowStride = 3 * srcWidth;
190 srcFormat = GL_RGB;
191 }
192 else {
193 pixels = (const GLchan *) srcAddr;
194 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
195 srcType) / sizeof(GLchan);
196 }
197
198 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
199 dstFormat,
200 texWidth, (GLubyte *) dstAddr);
201
202 if (ext_tx_compress_dxtn) {
203 (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
204 GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
205 dst, dstRowStride);
206 }
207 else {
208 _mesa_warning(ctx, "external dxt library not available: texstore_rgb_dxt1");
209 }
210
211 if (tempImage)
212 _mesa_free((void *) tempImage);
213
214 return GL_TRUE;
215 }
216
217
218 /**
219 * Store user's image in rgba_dxt1 format.
220 */
221 GLboolean
222 _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
223 {
224 const GLchan *pixels;
225 GLint srcRowStride;
226 GLubyte *dst;
227 const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
228 const GLchan *tempImage = NULL;
229
230 ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1);
231 ASSERT(dstXoffset % 4 == 0);
232 ASSERT(dstYoffset % 4 == 0);
233 ASSERT(dstZoffset % 4 == 0);
234 (void) dstZoffset;
235 (void) dstImageOffsets;
236
237 if (srcFormat != GL_RGBA ||
238 srcType != CHAN_TYPE ||
239 ctx->_ImageTransferState ||
240 srcPacking->SwapBytes) {
241 /* convert image to RGBA/GLchan */
242 tempImage = _mesa_make_temp_chan_image(ctx, dims,
243 baseInternalFormat,
244 _mesa_get_format_base_format(dstFormat),
245 srcWidth, srcHeight, srcDepth,
246 srcFormat, srcType, srcAddr,
247 srcPacking);
248 if (!tempImage)
249 return GL_FALSE; /* out of memory */
250 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
251 pixels = tempImage;
252 srcRowStride = 4 * srcWidth;
253 srcFormat = GL_RGBA;
254 }
255 else {
256 pixels = (const GLchan *) srcAddr;
257 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
258 srcType) / sizeof(GLchan);
259 }
260
261 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
262 dstFormat,
263 texWidth, (GLubyte *) dstAddr);
264 if (ext_tx_compress_dxtn) {
265 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
266 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
267 dst, dstRowStride);
268 }
269 else {
270 _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt1");
271 }
272
273 if (tempImage)
274 _mesa_free((void*) tempImage);
275
276 return GL_TRUE;
277 }
278
279
280 /**
281 * Store user's image in rgba_dxt3 format.
282 */
283 GLboolean
284 _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
285 {
286 const GLchan *pixels;
287 GLint srcRowStride;
288 GLubyte *dst;
289 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
290 const GLchan *tempImage = NULL;
291
292 ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3);
293 ASSERT(dstXoffset % 4 == 0);
294 ASSERT(dstYoffset % 4 == 0);
295 ASSERT(dstZoffset % 4 == 0);
296 (void) dstZoffset;
297 (void) dstImageOffsets;
298
299 if (srcFormat != GL_RGBA ||
300 srcType != CHAN_TYPE ||
301 ctx->_ImageTransferState ||
302 srcPacking->SwapBytes) {
303 /* convert image to RGBA/GLchan */
304 tempImage = _mesa_make_temp_chan_image(ctx, dims,
305 baseInternalFormat,
306 _mesa_get_format_base_format(dstFormat),
307 srcWidth, srcHeight, srcDepth,
308 srcFormat, srcType, srcAddr,
309 srcPacking);
310 if (!tempImage)
311 return GL_FALSE; /* out of memory */
312 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
313 pixels = tempImage;
314 srcRowStride = 4 * srcWidth;
315 }
316 else {
317 pixels = (const GLchan *) srcAddr;
318 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
319 srcType) / sizeof(GLchan);
320 }
321
322 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
323 dstFormat,
324 texWidth, (GLubyte *) dstAddr);
325 if (ext_tx_compress_dxtn) {
326 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
327 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
328 dst, dstRowStride);
329 }
330 else {
331 _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt3");
332 }
333
334 if (tempImage)
335 _mesa_free((void *) tempImage);
336
337 return GL_TRUE;
338 }
339
340
341 /**
342 * Store user's image in rgba_dxt5 format.
343 */
344 GLboolean
345 _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
346 {
347 const GLchan *pixels;
348 GLint srcRowStride;
349 GLubyte *dst;
350 const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
351 const GLchan *tempImage = NULL;
352
353 ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5);
354 ASSERT(dstXoffset % 4 == 0);
355 ASSERT(dstYoffset % 4 == 0);
356 ASSERT(dstZoffset % 4 == 0);
357 (void) dstZoffset;
358 (void) dstImageOffsets;
359
360 if (srcFormat != GL_RGBA ||
361 srcType != CHAN_TYPE ||
362 ctx->_ImageTransferState ||
363 srcPacking->SwapBytes) {
364 /* convert image to RGBA/GLchan */
365 tempImage = _mesa_make_temp_chan_image(ctx, dims,
366 baseInternalFormat,
367 _mesa_get_format_base_format(dstFormat),
368 srcWidth, srcHeight, srcDepth,
369 srcFormat, srcType, srcAddr,
370 srcPacking);
371 if (!tempImage)
372 return GL_FALSE; /* out of memory */
373 _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
374 pixels = tempImage;
375 srcRowStride = 4 * srcWidth;
376 }
377 else {
378 pixels = (const GLchan *) srcAddr;
379 srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
380 srcType) / sizeof(GLchan);
381 }
382
383 dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
384 dstFormat,
385 texWidth, (GLubyte *) dstAddr);
386 if (ext_tx_compress_dxtn) {
387 (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
388 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
389 dst, dstRowStride);
390 }
391 else {
392 _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt5");
393 }
394
395 if (tempImage)
396 _mesa_free((void *) tempImage);
397
398 return GL_TRUE;
399 }
400
401
402 static void
403 fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
404 GLint i, GLint j, GLint k, GLchan *texel )
405 {
406 (void) k;
407 if (fetch_ext_rgb_dxt1) {
408 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
409 fetch_ext_rgb_dxt1(texImage->RowStride,
410 (GLubyte *)(texImage)->Data, i, j, texel);
411 }
412 else
413 _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
414 }
415
416
417 void
418 _mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
419 GLint i, GLint j, GLint k, GLfloat *texel)
420 {
421 /* just sample as GLchan and convert to float here */
422 GLchan rgba[4];
423 fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
424 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
425 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
426 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
427 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
428 }
429
430
431 static void
432 fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
433 GLint i, GLint j, GLint k, GLchan *texel )
434 {
435 (void) k;
436 if (fetch_ext_rgba_dxt1) {
437 fetch_ext_rgba_dxt1(texImage->RowStride,
438 (GLubyte *)(texImage)->Data, i, j, texel);
439 }
440 else
441 _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
442 }
443
444
445 void
446 _mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
447 GLint i, GLint j, GLint k, GLfloat *texel)
448 {
449 /* just sample as GLchan and convert to float here */
450 GLchan rgba[4];
451 fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
452 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
453 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
454 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
455 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
456 }
457
458
459 static void
460 fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
461 GLint i, GLint j, GLint k, GLchan *texel )
462 {
463 (void) k;
464 if (fetch_ext_rgba_dxt3) {
465 ASSERT (sizeof(GLchan) == sizeof(GLubyte));
466 fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
467 i, j, texel);
468 }
469 else
470 _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n");
471 }
472
473
474 void
475 _mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
476 GLint i, GLint j, GLint k, GLfloat *texel)
477 {
478 /* just sample as GLchan and convert to float here */
479 GLchan rgba[4];
480 fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
481 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
482 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
483 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
484 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
485 }
486
487
488 static void
489 fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
490 GLint i, GLint j, GLint k, GLchan *texel )
491 {
492 (void) k;
493 if (fetch_ext_rgba_dxt5) {
494 fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
495 i, j, texel);
496 }
497 else
498 _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n");
499 }
500
501
502 void
503 _mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
504 GLint i, GLint j, GLint k, GLfloat *texel)
505 {
506 /* just sample as GLchan and convert to float here */
507 GLchan rgba[4];
508 fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
509 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
510 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
511 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
512 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
513 }
514
515 #if FEATURE_EXT_texture_sRGB
516 void
517 _mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
518 GLint i, GLint j, GLint k, GLfloat *texel )
519 {
520 /* just sample as GLchan and convert to float here */
521 GLchan rgba[4];
522 fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
523 texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
524 texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
525 texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
526 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
527 }
528
529 void
530 _mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
531 GLint i, GLint j, GLint k, GLfloat *texel)
532 {
533 /* just sample as GLchan and convert to float here */
534 GLchan rgba[4];
535 fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
536 texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
537 texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
538 texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
539 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
540 }
541
542 void
543 _mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
544 GLint i, GLint j, GLint k, GLfloat *texel)
545 {
546 /* just sample as GLchan and convert to float here */
547 GLchan rgba[4];
548 fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
549 texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
550 texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
551 texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
552 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
553 }
554
555 void
556 _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
557 GLint i, GLint j, GLint k, GLfloat *texel)
558 {
559 /* just sample as GLchan and convert to float here */
560 GLchan rgba[4];
561 fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
562 texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
563 texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
564 texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
565 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
566 }
567 #endif
568