gallium: Fix uninitialized variable warning in compute test.
[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 * 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.
23 *
24 **************************************************************************/
25
26 #include "u_dl.h"
27 #include "u_format.h"
28 #include "u_format_s3tc.h"
29 #include "util/format_srgb.h"
30 #include "util/u_math.h"
31 #include "../../../mesa/main/texcompress_s3tc_tmp.h"
32
33
34 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
35 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
36 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
37 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
38
39 util_format_dxtn_pack_t util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
40
41
42 /*
43 * Pixel fetch.
44 */
45
46 void
47 util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
48 {
49 util_format_dxt1_rgb_fetch(0, src, i, j, dst);
50 }
51
52 void
53 util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
54 {
55 util_format_dxt1_rgba_fetch(0, src, i, j, dst);
56 }
57
58 void
59 util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
60 {
61 util_format_dxt3_rgba_fetch(0, src, i, j, dst);
62 }
63
64 void
65 util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
66 {
67 util_format_dxt5_rgba_fetch(0, src, i, j, dst);
68 }
69
70 void
71 util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
72 {
73 uint8_t tmp[4];
74 util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
75 dst[0] = ubyte_to_float(tmp[0]);
76 dst[1] = ubyte_to_float(tmp[1]);
77 dst[2] = ubyte_to_float(tmp[2]);
78 dst[3] = 1.0;
79 }
80
81 void
82 util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
83 {
84 uint8_t tmp[4];
85 util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
86 dst[0] = ubyte_to_float(tmp[0]);
87 dst[1] = ubyte_to_float(tmp[1]);
88 dst[2] = ubyte_to_float(tmp[2]);
89 dst[3] = ubyte_to_float(tmp[3]);
90 }
91
92 void
93 util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
94 {
95 uint8_t tmp[4];
96 util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
97 dst[0] = ubyte_to_float(tmp[0]);
98 dst[1] = ubyte_to_float(tmp[1]);
99 dst[2] = ubyte_to_float(tmp[2]);
100 dst[3] = ubyte_to_float(tmp[3]);
101 }
102
103 void
104 util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
105 {
106 uint8_t tmp[4];
107 util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
108 dst[0] = ubyte_to_float(tmp[0]);
109 dst[1] = ubyte_to_float(tmp[1]);
110 dst[2] = ubyte_to_float(tmp[2]);
111 dst[3] = ubyte_to_float(tmp[3]);
112 }
113
114
115 /*
116 * Block decompression.
117 */
118
119 static inline void
120 util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
121 const uint8_t *src_row, unsigned src_stride,
122 unsigned width, unsigned height,
123 util_format_dxtn_fetch_t fetch,
124 unsigned block_size, boolean srgb)
125 {
126 const unsigned bw = 4, bh = 4, comps = 4;
127 unsigned x, y, i, j;
128 for(y = 0; y < height; y += bh) {
129 const uint8_t *src = src_row;
130 for(x = 0; x < width; x += bw) {
131 for(j = 0; j < bh; ++j) {
132 for(i = 0; i < bw; ++i) {
133 uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
134 fetch(0, src, i, j, dst);
135 if (srgb) {
136 dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
137 dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
138 dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
139 }
140 }
141 }
142 src += block_size;
143 }
144 src_row += src_stride;
145 }
146 }
147
148 void
149 util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
150 const uint8_t *src_row, unsigned src_stride,
151 unsigned width, unsigned height)
152 {
153 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
154 src_row, src_stride,
155 width, height,
156 util_format_dxt1_rgb_fetch,
157 8, FALSE);
158 }
159
160 void
161 util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
162 const uint8_t *src_row, unsigned src_stride,
163 unsigned width, unsigned height)
164 {
165 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
166 src_row, src_stride,
167 width, height,
168 util_format_dxt1_rgba_fetch,
169 8, FALSE);
170 }
171
172 void
173 util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
174 const uint8_t *src_row, unsigned src_stride,
175 unsigned width, unsigned height)
176 {
177 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
178 src_row, src_stride,
179 width, height,
180 util_format_dxt3_rgba_fetch,
181 16, FALSE);
182 }
183
184 void
185 util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
186 const uint8_t *src_row, unsigned src_stride,
187 unsigned width, unsigned height)
188 {
189 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
190 src_row, src_stride,
191 width, height,
192 util_format_dxt5_rgba_fetch,
193 16, FALSE);
194 }
195
196 static inline void
197 util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
198 const uint8_t *src_row, unsigned src_stride,
199 unsigned width, unsigned height,
200 util_format_dxtn_fetch_t fetch,
201 unsigned block_size, boolean srgb)
202 {
203 unsigned x, y, i, j;
204 for(y = 0; y < height; y += 4) {
205 const uint8_t *src = src_row;
206 for(x = 0; x < width; x += 4) {
207 for(j = 0; j < 4; ++j) {
208 for(i = 0; i < 4; ++i) {
209 float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
210 uint8_t tmp[4];
211 fetch(0, src, i, j, tmp);
212 if (srgb) {
213 dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
214 dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
215 dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
216 }
217 else {
218 dst[0] = ubyte_to_float(tmp[0]);
219 dst[1] = ubyte_to_float(tmp[1]);
220 dst[2] = ubyte_to_float(tmp[2]);
221 }
222 dst[3] = ubyte_to_float(tmp[3]);
223 }
224 }
225 src += block_size;
226 }
227 src_row += src_stride;
228 }
229 }
230
231 void
232 util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
233 const uint8_t *src_row, unsigned src_stride,
234 unsigned width, unsigned height)
235 {
236 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
237 src_row, src_stride,
238 width, height,
239 util_format_dxt1_rgb_fetch,
240 8, FALSE);
241 }
242
243 void
244 util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
245 const uint8_t *src_row, unsigned src_stride,
246 unsigned width, unsigned height)
247 {
248 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
249 src_row, src_stride,
250 width, height,
251 util_format_dxt1_rgba_fetch,
252 8, FALSE);
253 }
254
255 void
256 util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
257 const uint8_t *src_row, unsigned src_stride,
258 unsigned width, unsigned height)
259 {
260 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
261 src_row, src_stride,
262 width, height,
263 util_format_dxt3_rgba_fetch,
264 16, FALSE);
265 }
266
267 void
268 util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
269 const uint8_t *src_row, unsigned src_stride,
270 unsigned width, unsigned height)
271 {
272 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
273 src_row, src_stride,
274 width, height,
275 util_format_dxt5_rgba_fetch,
276 16, FALSE);
277 }
278
279
280 /*
281 * Block compression.
282 */
283
284 static inline void
285 util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
286 const uint8_t *src, unsigned src_stride,
287 unsigned width, unsigned height,
288 enum util_format_dxtn format,
289 unsigned block_size, boolean srgb)
290 {
291 const unsigned bw = 4, bh = 4, comps = 4;
292 unsigned x, y, i, j, k;
293 for(y = 0; y < height; y += bh) {
294 uint8_t *dst = dst_row;
295 for(x = 0; x < width; x += bw) {
296 uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
297 for(j = 0; j < bh; ++j) {
298 for(i = 0; i < bw; ++i) {
299 uint8_t src_tmp;
300 for(k = 0; k < 3; ++k) {
301 src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
302 if (srgb) {
303 tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
304 }
305 else {
306 tmp[j][i][k] = src_tmp;
307 }
308 }
309 /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
310 tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
311 }
312 }
313 /* even for dxt1_rgb have 4 src comps */
314 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
315 dst += block_size;
316 }
317 dst_row += dst_stride / sizeof(*dst_row);
318 }
319
320 }
321
322 void
323 util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
324 const uint8_t *src, unsigned src_stride,
325 unsigned width, unsigned height)
326 {
327 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
328 width, height, UTIL_FORMAT_DXT1_RGB,
329 8, FALSE);
330 }
331
332 void
333 util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
334 const uint8_t *src, unsigned src_stride,
335 unsigned width, unsigned height)
336 {
337 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
338 width, height, UTIL_FORMAT_DXT1_RGBA,
339 8, FALSE);
340 }
341
342 void
343 util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
344 const uint8_t *src, unsigned src_stride,
345 unsigned width, unsigned height)
346 {
347 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
348 width, height, UTIL_FORMAT_DXT3_RGBA,
349 16, FALSE);
350 }
351
352 void
353 util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
354 const uint8_t *src, unsigned src_stride,
355 unsigned width, unsigned height)
356 {
357 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
358 width, height, UTIL_FORMAT_DXT5_RGBA,
359 16, FALSE);
360 }
361
362 static inline void
363 util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
364 const float *src, unsigned src_stride,
365 unsigned width, unsigned height,
366 enum util_format_dxtn format,
367 unsigned block_size, boolean srgb)
368 {
369 unsigned x, y, i, j, k;
370 for(y = 0; y < height; y += 4) {
371 uint8_t *dst = dst_row;
372 for(x = 0; x < width; x += 4) {
373 uint8_t tmp[4][4][4];
374 for(j = 0; j < 4; ++j) {
375 for(i = 0; i < 4; ++i) {
376 float src_tmp;
377 for(k = 0; k < 3; ++k) {
378 src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
379 if (srgb) {
380 tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
381 }
382 else {
383 tmp[j][i][k] = float_to_ubyte(src_tmp);
384 }
385 }
386 /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
387 src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
388 tmp[j][i][3] = float_to_ubyte(src_tmp);
389 }
390 }
391 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
392 dst += block_size;
393 }
394 dst_row += 4*dst_stride/sizeof(*dst_row);
395 }
396 }
397
398 void
399 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
400 const float *src, unsigned src_stride,
401 unsigned width, unsigned height)
402 {
403 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
404 width, height, UTIL_FORMAT_DXT1_RGB,
405 8, FALSE);
406 }
407
408 void
409 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
410 const float *src, unsigned src_stride,
411 unsigned width, unsigned height)
412 {
413 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
414 width, height, UTIL_FORMAT_DXT1_RGBA,
415 8, FALSE);
416 }
417
418 void
419 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
420 const float *src, unsigned src_stride,
421 unsigned width, unsigned height)
422 {
423 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
424 width, height, UTIL_FORMAT_DXT3_RGBA,
425 16, FALSE);
426 }
427
428 void
429 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
430 const float *src, unsigned src_stride,
431 unsigned width, unsigned height)
432 {
433 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
434 width, height, UTIL_FORMAT_DXT5_RGBA,
435 16, FALSE);
436 }
437
438
439 /*
440 * SRGB variants.
441 */
442
443 void
444 util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
445 {
446 uint8_t tmp[4];
447 util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
448 dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
449 dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
450 dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
451 dst[3] = 255;
452 }
453
454 void
455 util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
456 {
457 uint8_t tmp[4];
458 util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
459 dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
460 dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
461 dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
462 dst[3] = tmp[3];
463 }
464
465 void
466 util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
467 {
468 uint8_t tmp[4];
469 util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
470 dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
471 dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
472 dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
473 dst[3] = tmp[3];
474 }
475
476 void
477 util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
478 {
479 uint8_t tmp[4];
480 util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
481 dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
482 dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
483 dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
484 dst[3] = tmp[3];
485 }
486
487 void
488 util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
489 {
490 uint8_t tmp[4];
491 util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
492 dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
493 dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
494 dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
495 dst[3] = 1.0f;
496 }
497
498 void
499 util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
500 {
501 uint8_t tmp[4];
502 util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
503 dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
504 dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
505 dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
506 dst[3] = ubyte_to_float(tmp[3]);
507 }
508
509 void
510 util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
511 {
512 uint8_t tmp[4];
513 util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
514 dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
515 dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
516 dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
517 dst[3] = ubyte_to_float(tmp[3]);
518 }
519
520 void
521 util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
522 {
523 uint8_t tmp[4];
524 util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
525 dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
526 dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
527 dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
528 dst[3] = ubyte_to_float(tmp[3]);
529 }
530
531 void
532 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)
533 {
534 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
535 src_row, src_stride,
536 width, height,
537 util_format_dxt1_rgb_fetch,
538 8, TRUE);
539 }
540
541 void
542 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)
543 {
544 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
545 src_row, src_stride,
546 width, height,
547 util_format_dxt1_rgba_fetch,
548 8, TRUE);
549 }
550
551 void
552 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)
553 {
554 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
555 src_row, src_stride,
556 width, height,
557 util_format_dxt3_rgba_fetch,
558 16, TRUE);
559 }
560
561 void
562 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)
563 {
564 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
565 src_row, src_stride,
566 width, height,
567 util_format_dxt5_rgba_fetch,
568 16, TRUE);
569 }
570
571 void
572 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)
573 {
574 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
575 src_row, src_stride,
576 width, height,
577 util_format_dxt1_rgb_fetch,
578 8, TRUE);
579 }
580
581 void
582 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)
583 {
584 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
585 src_row, src_stride,
586 width, height,
587 util_format_dxt1_rgba_fetch,
588 8, TRUE);
589 }
590
591 void
592 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)
593 {
594 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
595 src_row, src_stride,
596 width, height,
597 util_format_dxt3_rgba_fetch,
598 16, TRUE);
599 }
600
601 void
602 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)
603 {
604 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
605 src_row, src_stride,
606 width, height,
607 util_format_dxt5_rgba_fetch,
608 16, TRUE);
609 }
610
611 void
612 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)
613 {
614 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
615 width, height, UTIL_FORMAT_DXT1_RGB,
616 8, TRUE);
617 }
618
619 void
620 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)
621 {
622 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
623 width, height, UTIL_FORMAT_DXT1_RGBA,
624 8, TRUE);
625 }
626
627 void
628 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)
629 {
630 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
631 width, height, UTIL_FORMAT_DXT3_RGBA,
632 16, TRUE);
633 }
634
635 void
636 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)
637 {
638 util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
639 width, height, UTIL_FORMAT_DXT5_RGBA,
640 16, TRUE);
641 }
642
643 void
644 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)
645 {
646 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
647 width, height, UTIL_FORMAT_DXT1_RGB,
648 8, TRUE);
649 }
650
651 void
652 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)
653 {
654 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
655 width, height, UTIL_FORMAT_DXT1_RGBA,
656 8, TRUE);
657 }
658
659 void
660 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)
661 {
662 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
663 width, height, UTIL_FORMAT_DXT3_RGBA,
664 16, TRUE);
665 }
666
667 void
668 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)
669 {
670 util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
671 width, height, UTIL_FORMAT_DXT5_RGBA,
672 16, TRUE);
673 }
674