1 /**************************************************************************
3 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
4 * Copyright (c) 2008 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
24 **************************************************************************/
29 #include "u_format_s3tc.h"
30 #include "util/format_srgb.h"
33 #if defined(_WIN32) || defined(WIN32)
34 #define DXTN_LIBNAME "dxtn.dll"
35 #elif defined(__APPLE__)
36 #define DXTN_LIBNAME "libtxc_dxtn.dylib"
38 #define DXTN_LIBNAME "libtxc_dxtn.so"
43 util_format_dxt1_rgb_fetch_stub(int src_stride
,
53 util_format_dxt1_rgba_fetch_stub(int src_stride
,
63 util_format_dxt3_rgba_fetch_stub(int src_stride
,
73 util_format_dxt5_rgba_fetch_stub(int src_stride
,
83 util_format_dxtn_pack_stub(int src_comps
,
84 int width
, int height
,
86 enum util_format_dxtn dst_format
,
94 boolean util_format_s3tc_enabled
= FALSE
;
96 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch
= util_format_dxt1_rgb_fetch_stub
;
97 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch
= util_format_dxt1_rgba_fetch_stub
;
98 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch
= util_format_dxt3_rgba_fetch_stub
;
99 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch
= util_format_dxt5_rgba_fetch_stub
;
101 util_format_dxtn_pack_t util_format_dxtn_pack
= util_format_dxtn_pack_stub
;
105 util_format_s3tc_init(void)
107 static boolean first_time
= TRUE
;
108 struct util_dl_library
*library
= NULL
;
109 util_dl_proc fetch_2d_texel_rgb_dxt1
;
110 util_dl_proc fetch_2d_texel_rgba_dxt1
;
111 util_dl_proc fetch_2d_texel_rgba_dxt3
;
112 util_dl_proc fetch_2d_texel_rgba_dxt5
;
113 util_dl_proc tx_compress_dxtn
;
119 if (util_format_s3tc_enabled
)
122 library
= util_dl_open(DXTN_LIBNAME
);
124 debug_printf("couldn't open " DXTN_LIBNAME
", software DXTn "
125 "compression/decompression unavailable\n");
129 fetch_2d_texel_rgb_dxt1
=
130 util_dl_get_proc_address(library
, "fetch_2d_texel_rgb_dxt1");
131 fetch_2d_texel_rgba_dxt1
=
132 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt1");
133 fetch_2d_texel_rgba_dxt3
=
134 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt3");
135 fetch_2d_texel_rgba_dxt5
=
136 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt5");
138 util_dl_get_proc_address(library
, "tx_compress_dxtn");
140 if (!util_format_dxt1_rgb_fetch
||
141 !util_format_dxt1_rgba_fetch
||
142 !util_format_dxt3_rgba_fetch
||
143 !util_format_dxt5_rgba_fetch
||
144 !util_format_dxtn_pack
) {
145 debug_printf("couldn't reference all symbols in " DXTN_LIBNAME
146 ", software DXTn compression/decompression "
148 util_dl_close(library
);
152 util_format_dxt1_rgb_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgb_dxt1
;
153 util_format_dxt1_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt1
;
154 util_format_dxt3_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt3
;
155 util_format_dxt5_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt5
;
156 util_format_dxtn_pack
= (util_format_dxtn_pack_t
)tx_compress_dxtn
;
157 util_format_s3tc_enabled
= TRUE
;
166 util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
168 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
172 util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
174 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
178 util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
180 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
184 util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
186 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
190 util_format_dxt1_rgb_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
193 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
194 dst
[0] = ubyte_to_float(tmp
[0]);
195 dst
[1] = ubyte_to_float(tmp
[1]);
196 dst
[2] = ubyte_to_float(tmp
[2]);
201 util_format_dxt1_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
204 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
205 dst
[0] = ubyte_to_float(tmp
[0]);
206 dst
[1] = ubyte_to_float(tmp
[1]);
207 dst
[2] = ubyte_to_float(tmp
[2]);
208 dst
[3] = ubyte_to_float(tmp
[3]);
212 util_format_dxt3_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
215 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
216 dst
[0] = ubyte_to_float(tmp
[0]);
217 dst
[1] = ubyte_to_float(tmp
[1]);
218 dst
[2] = ubyte_to_float(tmp
[2]);
219 dst
[3] = ubyte_to_float(tmp
[3]);
223 util_format_dxt5_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
226 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
227 dst
[0] = ubyte_to_float(tmp
[0]);
228 dst
[1] = ubyte_to_float(tmp
[1]);
229 dst
[2] = ubyte_to_float(tmp
[2]);
230 dst
[3] = ubyte_to_float(tmp
[3]);
235 * Block decompression.
239 util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
240 const uint8_t *src_row
, unsigned src_stride
,
241 unsigned width
, unsigned height
,
242 util_format_dxtn_fetch_t fetch
,
243 unsigned block_size
, boolean srgb
)
245 const unsigned bw
= 4, bh
= 4, comps
= 4;
247 for(y
= 0; y
< height
; y
+= bh
) {
248 const uint8_t *src
= src_row
;
249 for(x
= 0; x
< width
; x
+= bw
) {
250 for(j
= 0; j
< bh
; ++j
) {
251 for(i
= 0; i
< bw
; ++i
) {
252 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*comps
;
253 fetch(0, src
, i
, j
, dst
);
255 dst
[0] = util_format_srgb_to_linear_8unorm(dst
[0]);
256 dst
[1] = util_format_srgb_to_linear_8unorm(dst
[1]);
257 dst
[2] = util_format_srgb_to_linear_8unorm(dst
[2]);
263 src_row
+= src_stride
;
268 util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
269 const uint8_t *src_row
, unsigned src_stride
,
270 unsigned width
, unsigned height
)
272 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
275 util_format_dxt1_rgb_fetch
,
280 util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
281 const uint8_t *src_row
, unsigned src_stride
,
282 unsigned width
, unsigned height
)
284 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
287 util_format_dxt1_rgba_fetch
,
292 util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
293 const uint8_t *src_row
, unsigned src_stride
,
294 unsigned width
, unsigned height
)
296 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
299 util_format_dxt3_rgba_fetch
,
304 util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
305 const uint8_t *src_row
, unsigned src_stride
,
306 unsigned width
, unsigned height
)
308 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
311 util_format_dxt5_rgba_fetch
,
316 util_format_dxtn_rgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
317 const uint8_t *src_row
, unsigned src_stride
,
318 unsigned width
, unsigned height
,
319 util_format_dxtn_fetch_t fetch
,
320 unsigned block_size
, boolean srgb
)
323 for(y
= 0; y
< height
; y
+= 4) {
324 const uint8_t *src
= src_row
;
325 for(x
= 0; x
< width
; x
+= 4) {
326 for(j
= 0; j
< 4; ++j
) {
327 for(i
= 0; i
< 4; ++i
) {
328 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
330 fetch(0, src
, i
, j
, tmp
);
332 dst
[0] = util_format_srgb_8unorm_to_linear_float(tmp
[0]);
333 dst
[1] = util_format_srgb_8unorm_to_linear_float(tmp
[1]);
334 dst
[2] = util_format_srgb_8unorm_to_linear_float(tmp
[2]);
337 dst
[0] = ubyte_to_float(tmp
[0]);
338 dst
[1] = ubyte_to_float(tmp
[1]);
339 dst
[2] = ubyte_to_float(tmp
[2]);
341 dst
[3] = ubyte_to_float(tmp
[3]);
346 src_row
+= src_stride
;
351 util_format_dxt1_rgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
352 const uint8_t *src_row
, unsigned src_stride
,
353 unsigned width
, unsigned height
)
355 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
358 util_format_dxt1_rgb_fetch
,
363 util_format_dxt1_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
364 const uint8_t *src_row
, unsigned src_stride
,
365 unsigned width
, unsigned height
)
367 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
370 util_format_dxt1_rgba_fetch
,
375 util_format_dxt3_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
376 const uint8_t *src_row
, unsigned src_stride
,
377 unsigned width
, unsigned height
)
379 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
382 util_format_dxt3_rgba_fetch
,
387 util_format_dxt5_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
388 const uint8_t *src_row
, unsigned src_stride
,
389 unsigned width
, unsigned height
)
391 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
394 util_format_dxt5_rgba_fetch
,
404 util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
405 const uint8_t *src
, unsigned src_stride
,
406 unsigned width
, unsigned height
,
407 enum util_format_dxtn format
,
408 unsigned block_size
, boolean srgb
)
410 const unsigned bw
= 4, bh
= 4, comps
= 4;
411 unsigned x
, y
, i
, j
, k
;
412 for(y
= 0; y
< height
; y
+= bh
) {
413 uint8_t *dst
= dst_row
;
414 for(x
= 0; x
< width
; x
+= bw
) {
415 uint8_t tmp
[4][4][4]; /* [bh][bw][comps] */
416 for(j
= 0; j
< bh
; ++j
) {
417 for(i
= 0; i
< bw
; ++i
) {
419 for(k
= 0; k
< 3; ++k
) {
420 src_tmp
= src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*comps
+ k
];
422 tmp
[j
][i
][k
] = util_format_linear_to_srgb_8unorm(src_tmp
);
425 tmp
[j
][i
][k
] = src_tmp
;
428 /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
429 tmp
[j
][i
][3] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*comps
+ 3];
432 /* even for dxt1_rgb have 4 src comps */
433 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], format
, dst
, 0);
436 dst_row
+= dst_stride
/ sizeof(*dst_row
);
442 util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
443 const uint8_t *src
, unsigned src_stride
,
444 unsigned width
, unsigned height
)
446 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src
, src_stride
,
447 width
, height
, UTIL_FORMAT_DXT1_RGB
,
452 util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
453 const uint8_t *src
, unsigned src_stride
,
454 unsigned width
, unsigned height
)
456 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src
, src_stride
,
457 width
, height
, UTIL_FORMAT_DXT1_RGBA
,
462 util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
463 const uint8_t *src
, unsigned src_stride
,
464 unsigned width
, unsigned height
)
466 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src
, src_stride
,
467 width
, height
, UTIL_FORMAT_DXT3_RGBA
,
472 util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
473 const uint8_t *src
, unsigned src_stride
,
474 unsigned width
, unsigned height
)
476 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src
, src_stride
,
477 width
, height
, UTIL_FORMAT_DXT5_RGBA
,
482 util_format_dxtn_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
483 const float *src
, unsigned src_stride
,
484 unsigned width
, unsigned height
,
485 enum util_format_dxtn format
,
486 unsigned block_size
, boolean srgb
)
488 unsigned x
, y
, i
, j
, k
;
489 for(y
= 0; y
< height
; y
+= 4) {
490 uint8_t *dst
= dst_row
;
491 for(x
= 0; x
< width
; x
+= 4) {
492 uint8_t tmp
[4][4][4];
493 for(j
= 0; j
< 4; ++j
) {
494 for(i
= 0; i
< 4; ++i
) {
496 for(k
= 0; k
< 3; ++k
) {
497 src_tmp
= src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + k
];
499 tmp
[j
][i
][k
] = util_format_linear_float_to_srgb_8unorm(src_tmp
);
502 tmp
[j
][i
][k
] = float_to_ubyte(src_tmp
);
505 /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
506 src_tmp
= src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + 3];
507 tmp
[j
][i
][3] = float_to_ubyte(src_tmp
);
510 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], format
, dst
, 0);
513 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
518 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
519 const float *src
, unsigned src_stride
,
520 unsigned width
, unsigned height
)
522 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src
, src_stride
,
523 width
, height
, UTIL_FORMAT_DXT1_RGB
,
528 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
529 const float *src
, unsigned src_stride
,
530 unsigned width
, unsigned height
)
532 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src
, src_stride
,
533 width
, height
, UTIL_FORMAT_DXT1_RGBA
,
538 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
539 const float *src
, unsigned src_stride
,
540 unsigned width
, unsigned height
)
542 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src
, src_stride
,
543 width
, height
, UTIL_FORMAT_DXT3_RGBA
,
548 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
549 const float *src
, unsigned src_stride
,
550 unsigned width
, unsigned height
)
552 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src
, src_stride
,
553 width
, height
, UTIL_FORMAT_DXT5_RGBA
,
563 util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
566 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
567 dst
[0] = util_format_srgb_to_linear_8unorm(tmp
[0]);
568 dst
[1] = util_format_srgb_to_linear_8unorm(tmp
[1]);
569 dst
[2] = util_format_srgb_to_linear_8unorm(tmp
[2]);
574 util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
577 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
578 dst
[0] = util_format_srgb_to_linear_8unorm(tmp
[0]);
579 dst
[1] = util_format_srgb_to_linear_8unorm(tmp
[1]);
580 dst
[2] = util_format_srgb_to_linear_8unorm(tmp
[2]);
585 util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
588 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
589 dst
[0] = util_format_srgb_to_linear_8unorm(tmp
[0]);
590 dst
[1] = util_format_srgb_to_linear_8unorm(tmp
[1]);
591 dst
[2] = util_format_srgb_to_linear_8unorm(tmp
[2]);
596 util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
599 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
600 dst
[0] = util_format_srgb_to_linear_8unorm(tmp
[0]);
601 dst
[1] = util_format_srgb_to_linear_8unorm(tmp
[1]);
602 dst
[2] = util_format_srgb_to_linear_8unorm(tmp
[2]);
607 util_format_dxt1_srgb_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
610 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
611 dst
[0] = util_format_srgb_8unorm_to_linear_float(tmp
[0]);
612 dst
[1] = util_format_srgb_8unorm_to_linear_float(tmp
[1]);
613 dst
[2] = util_format_srgb_8unorm_to_linear_float(tmp
[2]);
618 util_format_dxt1_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
621 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
622 dst
[0] = util_format_srgb_8unorm_to_linear_float(tmp
[0]);
623 dst
[1] = util_format_srgb_8unorm_to_linear_float(tmp
[1]);
624 dst
[2] = util_format_srgb_8unorm_to_linear_float(tmp
[2]);
625 dst
[3] = ubyte_to_float(tmp
[3]);
629 util_format_dxt3_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
632 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
633 dst
[0] = util_format_srgb_8unorm_to_linear_float(tmp
[0]);
634 dst
[1] = util_format_srgb_8unorm_to_linear_float(tmp
[1]);
635 dst
[2] = util_format_srgb_8unorm_to_linear_float(tmp
[2]);
636 dst
[3] = ubyte_to_float(tmp
[3]);
640 util_format_dxt5_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
643 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
644 dst
[0] = util_format_srgb_8unorm_to_linear_float(tmp
[0]);
645 dst
[1] = util_format_srgb_8unorm_to_linear_float(tmp
[1]);
646 dst
[2] = util_format_srgb_8unorm_to_linear_float(tmp
[2]);
647 dst
[3] = ubyte_to_float(tmp
[3]);
651 util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
653 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
656 util_format_dxt1_rgb_fetch
,
661 util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
663 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
666 util_format_dxt1_rgba_fetch
,
671 util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
673 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
676 util_format_dxt3_rgba_fetch
,
681 util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
683 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
686 util_format_dxt5_rgba_fetch
,
691 util_format_dxt1_srgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
693 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
696 util_format_dxt1_rgb_fetch
,
701 util_format_dxt1_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
703 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
706 util_format_dxt1_rgba_fetch
,
711 util_format_dxt3_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
713 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
716 util_format_dxt3_rgba_fetch
,
721 util_format_dxt5_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
723 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
726 util_format_dxt5_rgba_fetch
,
731 util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
733 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
,
734 width
, height
, UTIL_FORMAT_DXT1_RGB
,
739 util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
741 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
,
742 width
, height
, UTIL_FORMAT_DXT1_RGBA
,
747 util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
749 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
,
750 width
, height
, UTIL_FORMAT_DXT3_RGBA
,
755 util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
757 util_format_dxtn_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
,
758 width
, height
, UTIL_FORMAT_DXT5_RGBA
,
763 util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
765 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
,
766 width
, height
, UTIL_FORMAT_DXT1_RGB
,
771 util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
773 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
,
774 width
, height
, UTIL_FORMAT_DXT1_RGBA
,
779 util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
781 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
,
782 width
, height
, UTIL_FORMAT_DXT3_RGBA
,
787 util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
789 util_format_dxtn_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
,
790 width
, height
, UTIL_FORMAT_DXT5_RGBA
,