4a9dc2237e42dd69e8140296db9a4f513c3a67fb
[mesa.git] / src / gallium / auxiliary / util / u_format_s3tc.c
1 /**************************************************************************
2 *
3 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
4 * Copyright (c) 2008 VMware, Inc.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 **************************************************************************/
24
25 #include "u_dl.h"
26 #include "u_math.h"
27 #include "u_format.h"
28 #include "u_format_s3tc.h"
29
30
31 #if defined(_WIN32) || defined(WIN32)
32 #define DXTN_LIBNAME "dxtn.dll"
33 #elif defined(__APPLE__)
34 #define DXTN_LIBNAME "libtxc_dxtn.dylib"
35 #else
36 #define DXTN_LIBNAME "libtxc_dxtn.so"
37 #endif
38
39
40 static void
41 util_format_dxt1_rgb_fetch_stub(int src_stride,
42 const uint8_t *src,
43 int col, int row,
44 uint8_t *dst)
45 {
46 assert(0);
47 }
48
49
50 static void
51 util_format_dxt1_rgba_fetch_stub(int src_stride,
52 const uint8_t *src,
53 int col, int row,
54 uint8_t *dst )
55 {
56 assert(0);
57 }
58
59
60 static void
61 util_format_dxt3_rgba_fetch_stub(int src_stride,
62 const uint8_t *src,
63 int col, int row,
64 uint8_t *dst )
65 {
66 assert(0);
67 }
68
69
70 static void
71 util_format_dxt5_rgba_fetch_stub(int src_stride,
72 const uint8_t *src,
73 int col, int row,
74 uint8_t *dst )
75 {
76 assert(0);
77 }
78
79
80 static void
81 util_format_dxtn_pack_stub(int src_comps,
82 int width, int height,
83 const uint8_t *src,
84 enum util_format_dxtn dst_format,
85 uint8_t *dst,
86 int dst_stride)
87 {
88 assert(0);
89 }
90
91
92 boolean util_format_s3tc_enabled = FALSE;
93
94 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub;
95 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = util_format_dxt1_rgba_fetch_stub;
96 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = util_format_dxt3_rgba_fetch_stub;
97 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = util_format_dxt5_rgba_fetch_stub;
98
99 util_format_dxtn_pack_t util_format_dxtn_pack = util_format_dxtn_pack_stub;
100
101
102 void
103 util_format_s3tc_init(void)
104 {
105 static boolean first_time = TRUE;
106 struct util_dl_library *library = NULL;
107 util_dl_proc fetch_2d_texel_rgb_dxt1;
108 util_dl_proc fetch_2d_texel_rgba_dxt1;
109 util_dl_proc fetch_2d_texel_rgba_dxt3;
110 util_dl_proc fetch_2d_texel_rgba_dxt5;
111 util_dl_proc tx_compress_dxtn;
112 char *force_s3tc_enable;
113
114 if (!first_time)
115 return;
116 first_time = FALSE;
117
118 if (util_format_s3tc_enabled)
119 return;
120
121 library = util_dl_open(DXTN_LIBNAME);
122 if (!library) {
123 if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
124 !strcmp(force_s3tc_enable, "true")) {
125 debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
126 "force_s3tc_enable=true environment variable\n");
127 util_format_s3tc_enabled = TRUE;
128 } else {
129 debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
130 "compression/decompression unavailable\n");
131 }
132 return;
133 }
134
135 fetch_2d_texel_rgb_dxt1 =
136 util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1");
137 fetch_2d_texel_rgba_dxt1 =
138 util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1");
139 fetch_2d_texel_rgba_dxt3 =
140 util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3");
141 fetch_2d_texel_rgba_dxt5 =
142 util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5");
143 tx_compress_dxtn =
144 util_dl_get_proc_address(library, "tx_compress_dxtn");
145
146 if (!util_format_dxt1_rgb_fetch ||
147 !util_format_dxt1_rgba_fetch ||
148 !util_format_dxt3_rgba_fetch ||
149 !util_format_dxt5_rgba_fetch ||
150 !util_format_dxtn_pack) {
151 debug_printf("couldn't reference all symbols in " DXTN_LIBNAME
152 ", software DXTn compression/decompression "
153 "unavailable\n");
154 util_dl_close(library);
155 return;
156 }
157
158 util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
159 util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
160 util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
161 util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
162 util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
163 util_format_s3tc_enabled = TRUE;
164 }
165
166
167 /*
168 * Pixel fetch.
169 */
170
171 void
172 util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
173 {
174 util_format_dxt1_rgb_fetch(0, src, i, j, dst);
175 }
176
177 void
178 util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
179 {
180 util_format_dxt1_rgba_fetch(0, src, i, j, dst);
181 }
182
183 void
184 util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
185 {
186 util_format_dxt3_rgba_fetch(0, src, i, j, dst);
187 }
188
189 void
190 util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
191 {
192 util_format_dxt5_rgba_fetch(0, src, i, j, dst);
193 }
194
195 void
196 util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
197 {
198 uint8_t tmp[4];
199 util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
200 dst[0] = ubyte_to_float(tmp[0]);
201 dst[1] = ubyte_to_float(tmp[1]);
202 dst[2] = ubyte_to_float(tmp[2]);
203 dst[3] = 1.0;
204 }
205
206 void
207 util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
208 {
209 uint8_t tmp[4];
210 util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
211 dst[0] = ubyte_to_float(tmp[0]);
212 dst[1] = ubyte_to_float(tmp[1]);
213 dst[2] = ubyte_to_float(tmp[2]);
214 dst[3] = ubyte_to_float(tmp[3]);
215 }
216
217 void
218 util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
219 {
220 uint8_t tmp[4];
221 util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
222 dst[0] = ubyte_to_float(tmp[0]);
223 dst[1] = ubyte_to_float(tmp[1]);
224 dst[2] = ubyte_to_float(tmp[2]);
225 dst[3] = ubyte_to_float(tmp[3]);
226 }
227
228 void
229 util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
230 {
231 uint8_t tmp[4];
232 util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
233 dst[0] = ubyte_to_float(tmp[0]);
234 dst[1] = ubyte_to_float(tmp[1]);
235 dst[2] = ubyte_to_float(tmp[2]);
236 dst[3] = ubyte_to_float(tmp[3]);
237 }
238
239
240 /*
241 * Block decompression.
242 */
243
244 static INLINE void
245 util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
246 const uint8_t *src_row, unsigned src_stride,
247 unsigned width, unsigned height,
248 util_format_dxtn_fetch_t fetch,
249 unsigned block_size)
250 {
251 const unsigned bw = 4, bh = 4, comps = 4;
252 unsigned x, y, i, j;
253 for(y = 0; y < height; y += bh) {
254 const uint8_t *src = src_row;
255 for(x = 0; x < width; x += bw) {
256 for(j = 0; j < bh; ++j) {
257 for(i = 0; i < bw; ++i) {
258 uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
259 fetch(0, src, i, j, dst);
260 }
261 }
262 src += block_size;
263 }
264 src_row += src_stride;
265 }
266 }
267
268 void
269 util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
270 const uint8_t *src_row, unsigned src_stride,
271 unsigned width, unsigned height)
272 {
273 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
274 src_row, src_stride,
275 width, height,
276 util_format_dxt1_rgb_fetch, 8);
277 }
278
279 void
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)
283 {
284 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
285 src_row, src_stride,
286 width, height,
287 util_format_dxt1_rgba_fetch, 8);
288 }
289
290 void
291 util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
292 const uint8_t *src_row, unsigned src_stride,
293 unsigned width, unsigned height)
294 {
295 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
296 src_row, src_stride,
297 width, height,
298 util_format_dxt3_rgba_fetch, 16);
299 }
300
301 void
302 util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
303 const uint8_t *src_row, unsigned src_stride,
304 unsigned width, unsigned height)
305 {
306 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
307 src_row, src_stride,
308 width, height,
309 util_format_dxt5_rgba_fetch, 16);
310 }
311
312 static INLINE void
313 util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
314 const uint8_t *src_row, unsigned src_stride,
315 unsigned width, unsigned height,
316 util_format_dxtn_fetch_t fetch,
317 unsigned block_size)
318 {
319 unsigned x, y, i, j;
320 for(y = 0; y < height; y += 4) {
321 const uint8_t *src = src_row;
322 for(x = 0; x < width; x += 4) {
323 for(j = 0; j < 4; ++j) {
324 for(i = 0; i < 4; ++i) {
325 float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
326 uint8_t tmp[4];
327 fetch(0, src, i, j, tmp);
328 dst[0] = ubyte_to_float(tmp[0]);
329 dst[1] = ubyte_to_float(tmp[1]);
330 dst[2] = ubyte_to_float(tmp[2]);
331 dst[3] = ubyte_to_float(tmp[3]);
332 }
333 }
334 src += block_size;
335 }
336 src_row += src_stride;
337 }
338 }
339
340 void
341 util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
342 const uint8_t *src_row, unsigned src_stride,
343 unsigned width, unsigned height)
344 {
345 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
346 src_row, src_stride,
347 width, height,
348 util_format_dxt1_rgb_fetch, 8);
349 }
350
351 void
352 util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
353 const uint8_t *src_row, unsigned src_stride,
354 unsigned width, unsigned height)
355 {
356 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
357 src_row, src_stride,
358 width, height,
359 util_format_dxt1_rgba_fetch, 8);
360 }
361
362 void
363 util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
364 const uint8_t *src_row, unsigned src_stride,
365 unsigned width, unsigned height)
366 {
367 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
368 src_row, src_stride,
369 width, height,
370 util_format_dxt3_rgba_fetch, 16);
371 }
372
373 void
374 util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
375 const uint8_t *src_row, unsigned src_stride,
376 unsigned width, unsigned height)
377 {
378 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
379 src_row, src_stride,
380 width, height,
381 util_format_dxt5_rgba_fetch, 16);
382 }
383
384
385 /*
386 * Block compression.
387 */
388
389 void
390 util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
391 const uint8_t *src, unsigned src_stride,
392 unsigned width, unsigned height)
393 {
394 const unsigned bw = 4, bh = 4, bytes_per_block = 8;
395 unsigned x, y, i, j, k;
396 for(y = 0; y < height; y += bh) {
397 uint8_t *dst = dst_row;
398 for(x = 0; x < width; x += bw) {
399 uint8_t tmp[4][4][3]; /* [bh][bw][comps] */
400 for(j = 0; j < bh; ++j) {
401 for(i = 0; i < bw; ++i) {
402 for(k = 0; k < 3; ++k) {
403 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*4 + k];
404 }
405 }
406 }
407 util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
408 dst += bytes_per_block;
409 }
410 dst_row += dst_stride / sizeof(*dst_row);
411 }
412 }
413
414 void
415 util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
416 const uint8_t *src, unsigned src_stride,
417 unsigned width, unsigned height)
418 {
419 const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 8;
420 unsigned x, y, i, j, k;
421 for(y = 0; y < height; y += bh) {
422 uint8_t *dst = dst_row;
423 for(x = 0; x < width; x += bw) {
424 uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
425 for(j = 0; j < bh; ++j) {
426 for(i = 0; i < bw; ++i) {
427 for(k = 0; k < comps; ++k) {
428 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
429 }
430 }
431 }
432 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
433 dst += bytes_per_block;
434 }
435 dst_row += dst_stride / sizeof(*dst_row);
436 }
437 }
438
439 void
440 util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
441 const uint8_t *src, unsigned src_stride,
442 unsigned width, unsigned height)
443 {
444 const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
445 unsigned x, y, i, j, k;
446 for(y = 0; y < height; y += bh) {
447 uint8_t *dst = dst_row;
448 for(x = 0; x < width; x += bw) {
449 uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
450 for(j = 0; j < bh; ++j) {
451 for(i = 0; i < bw; ++i) {
452 for(k = 0; k < comps; ++k) {
453 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
454 }
455 }
456 }
457 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
458 dst += bytes_per_block;
459 }
460 dst_row += dst_stride / sizeof(*dst_row);
461 }
462 }
463
464 void
465 util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
466 const uint8_t *src, unsigned src_stride,
467 unsigned width, unsigned height)
468 {
469 const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
470 unsigned x, y, i, j, k;
471
472 for(y = 0; y < height; y += bh) {
473 uint8_t *dst = dst_row;
474 for(x = 0; x < width; x += bw) {
475 uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
476 for(j = 0; j < bh; ++j) {
477 for(i = 0; i < bw; ++i) {
478 for(k = 0; k < comps; ++k) {
479 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
480 }
481 }
482 }
483 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
484 dst += bytes_per_block;
485 }
486 dst_row += dst_stride / sizeof(*dst_row);
487 }
488 }
489
490 void
491 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
492 const float *src, unsigned src_stride,
493 unsigned width, unsigned height)
494 {
495 unsigned x, y, i, j, k;
496 for(y = 0; y < height; y += 4) {
497 uint8_t *dst = dst_row;
498 for(x = 0; x < width; x += 4) {
499 uint8_t tmp[4][4][3];
500 for(j = 0; j < 4; ++j) {
501 for(i = 0; i < 4; ++i) {
502 for(k = 0; k < 3; ++k) {
503 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
504 }
505 }
506 }
507 util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
508 dst += 8;
509 }
510 dst_row += 4*dst_stride/sizeof(*dst_row);
511 }
512 }
513
514 void
515 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
516 const float *src, unsigned src_stride,
517 unsigned width, unsigned height)
518 {
519 unsigned x, y, i, j, k;
520 for(y = 0; y < height; y += 4) {
521 uint8_t *dst = dst_row;
522 for(x = 0; x < width; x += 4) {
523 uint8_t tmp[4][4][4];
524 for(j = 0; j < 4; ++j) {
525 for(i = 0; i < 4; ++i) {
526 for(k = 0; k < 4; ++k) {
527 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
528 }
529 }
530 }
531 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
532 dst += 8;
533 }
534 dst_row += 4*dst_stride/sizeof(*dst_row);
535 }
536 }
537
538 void
539 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
540 const float *src, unsigned src_stride,
541 unsigned width, unsigned height)
542 {
543 unsigned x, y, i, j, k;
544 for(y = 0; y < height; y += 4) {
545 uint8_t *dst = dst_row;
546 for(x = 0; x < width; x += 4) {
547 uint8_t tmp[4][4][4];
548 for(j = 0; j < 4; ++j) {
549 for(i = 0; i < 4; ++i) {
550 for(k = 0; k < 4; ++k) {
551 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
552 }
553 }
554 }
555 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
556 dst += 16;
557 }
558 dst_row += 4*dst_stride/sizeof(*dst_row);
559 }
560 }
561
562 void
563 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
564 const float *src, unsigned src_stride,
565 unsigned width, unsigned height)
566 {
567 unsigned x, y, i, j, k;
568 for(y = 0; y < height; y += 4) {
569 uint8_t *dst = dst_row;
570 for(x = 0; x < width; x += 4) {
571 uint8_t tmp[4][4][4];
572 for(j = 0; j < 4; ++j) {
573 for(i = 0; i < 4; ++i) {
574 for(k = 0; k < 4; ++k) {
575 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
576 }
577 }
578 }
579 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
580 dst += 16;
581 }
582 dst_row += 4*dst_stride/sizeof(*dst_row);
583 }
584 }
585
586
587 /*
588 * SRGB variants.
589 *
590 * FIXME: shunts to RGB for now
591 */
592
593 void
594 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)
595 {
596 util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
597 }
598
599 void
600 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)
601 {
602 util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
603 }
604
605 void
606 util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
607 {
608 util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j);
609 }
610
611 void
612 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)
613 {
614 util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
615 }
616
617 void
618 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)
619 {
620 util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
621 }
622
623 void
624 util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
625 {
626 util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j);
627 }
628
629 void
630 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)
631 {
632 util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
633 }
634
635 void
636 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)
637 {
638 util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
639 }
640
641 void
642 util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
643 {
644 util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j);
645 }
646
647 void
648 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)
649 {
650 util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
651 }
652
653 void
654 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)
655 {
656 util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
657 }
658
659 void
660 util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
661 {
662 util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j);
663 }
664
665 void
666 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)
667 {
668 util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
669 }
670
671 void
672 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)
673 {
674 util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
675 }
676
677 void
678 util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
679 {
680 util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j);
681 }
682
683 void
684 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)
685 {
686 util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
687 }
688
689 void
690 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)
691 {
692 util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
693 }
694
695 void
696 util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
697 {
698 util_format_dxt1_rgba_fetch_rgba_float(dst, src, i, j);
699 }
700
701 void
702 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)
703 {
704 util_format_dxt3_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
705 }
706
707 void
708 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)
709 {
710 util_format_dxt3_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
711 }
712
713 void
714 util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
715 {
716 util_format_dxt3_rgba_fetch_rgba_float(dst, src, i, j);
717 }
718
719 void
720 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)
721 {
722 util_format_dxt5_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
723 }
724
725 void
726 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)
727 {
728 util_format_dxt5_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
729 }
730
731 void
732 util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
733 {
734 util_format_dxt5_rgba_fetch_rgba_float(dst, src, i, j);
735 }
736