Merge remote branch 'origin/master' into lp-setup-llvm
[mesa.git] / src / gallium / tests / unit / u_format_test.c
1 /**************************************************************************
2 *
3 * Copyright 2009-2010 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * 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
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <float.h>
32
33 #include "util/u_half.h"
34 #include "util/u_format.h"
35 #include "util/u_format_tests.h"
36 #include "util/u_format_s3tc.h"
37
38
39 static boolean
40 compare_float(float x, float y)
41 {
42 float error = y - x;
43
44 if (error < 0.0f)
45 error = -error;
46
47 if (error > FLT_EPSILON) {
48 return FALSE;
49 }
50
51 return TRUE;
52 }
53
54
55 static void
56 print_packed(const struct util_format_description *format_desc,
57 const char *prefix,
58 const uint8_t *packed,
59 const char *suffix)
60 {
61 unsigned i;
62 const char *sep = "";
63
64 printf("%s", prefix);
65 for (i = 0; i < format_desc->block.bits/8; ++i) {
66 printf("%s%02x", sep, packed[i]);
67 sep = " ";
68 }
69 printf("%s", suffix);
70 fflush(stdout);
71 }
72
73
74 static void
75 print_unpacked_rgba_doubl(const struct util_format_description *format_desc,
76 const char *prefix,
77 const double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
78 const char *suffix)
79 {
80 unsigned i, j;
81 const char *sep = "";
82
83 printf("%s", prefix);
84 for (i = 0; i < format_desc->block.height; ++i) {
85 for (j = 0; j < format_desc->block.width; ++j) {
86 printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
87 sep = ", ";
88 }
89 sep = ",\n";
90 }
91 printf("%s", suffix);
92 fflush(stdout);
93 }
94
95
96 static void
97 print_unpacked_rgba_float(const struct util_format_description *format_desc,
98 const char *prefix,
99 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
100 const char *suffix)
101 {
102 unsigned i, j;
103 const char *sep = "";
104
105 printf("%s", prefix);
106 for (i = 0; i < format_desc->block.height; ++i) {
107 for (j = 0; j < format_desc->block.width; ++j) {
108 printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
109 sep = ", ";
110 }
111 sep = ",\n";
112 }
113 printf("%s", suffix);
114 fflush(stdout);
115 }
116
117
118 static void
119 print_unpacked_rgba_8unorm(const struct util_format_description *format_desc,
120 const char *prefix,
121 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
122 const char *suffix)
123 {
124 unsigned i, j;
125 const char *sep = "";
126
127 printf("%s", prefix);
128 for (i = 0; i < format_desc->block.height; ++i) {
129 for (j = 0; j < format_desc->block.width; ++j) {
130 printf("%s{0x%02x, 0x%02x, 0x%02x, 0x%02x}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
131 sep = ", ";
132 }
133 }
134 printf("%s", suffix);
135 fflush(stdout);
136 }
137
138
139 static void
140 print_unpacked_z_float(const struct util_format_description *format_desc,
141 const char *prefix,
142 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
143 const char *suffix)
144 {
145 unsigned i, j;
146 const char *sep = "";
147
148 printf("%s", prefix);
149 for (i = 0; i < format_desc->block.height; ++i) {
150 for (j = 0; j < format_desc->block.width; ++j) {
151 printf("%s%f", sep, unpacked[i][j]);
152 sep = ", ";
153 }
154 sep = ",\n";
155 }
156 printf("%s", suffix);
157 fflush(stdout);
158 }
159
160
161 static void
162 print_unpacked_z_32unorm(const struct util_format_description *format_desc,
163 const char *prefix,
164 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
165 const char *suffix)
166 {
167 unsigned i, j;
168 const char *sep = "";
169
170 printf("%s", prefix);
171 for (i = 0; i < format_desc->block.height; ++i) {
172 for (j = 0; j < format_desc->block.width; ++j) {
173 printf("%s0x%08x", sep, unpacked[i][j]);
174 sep = ", ";
175 }
176 }
177 printf("%s", suffix);
178 fflush(stdout);
179 }
180
181
182 static void
183 print_unpacked_s_8uscaled(const struct util_format_description *format_desc,
184 const char *prefix,
185 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
186 const char *suffix)
187 {
188 unsigned i, j;
189 const char *sep = "";
190
191 printf("%s", prefix);
192 for (i = 0; i < format_desc->block.height; ++i) {
193 for (j = 0; j < format_desc->block.width; ++j) {
194 printf("%s0x%02x", sep, unpacked[i][j]);
195 sep = ", ";
196 }
197 }
198 printf("%s", suffix);
199 fflush(stdout);
200 }
201
202
203 static boolean
204 test_format_fetch_rgba_float(const struct util_format_description *format_desc,
205 const struct util_format_test_case *test)
206 {
207 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
208 unsigned i, j, k;
209 boolean success;
210
211 success = TRUE;
212 for (i = 0; i < format_desc->block.height; ++i) {
213 for (j = 0; j < format_desc->block.width; ++j) {
214 format_desc->fetch_rgba_float(unpacked[i][j], test->packed, j, i);
215 for (k = 0; k < 4; ++k) {
216 if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
217 success = FALSE;
218 }
219 }
220 }
221 }
222
223 if (!success) {
224 print_unpacked_rgba_float(format_desc, "FAILED: ", unpacked, " obtained\n");
225 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
226 }
227
228 return success;
229 }
230
231
232 static boolean
233 test_format_unpack_rgba_float(const struct util_format_description *format_desc,
234 const struct util_format_test_case *test)
235 {
236 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
237 unsigned i, j, k;
238 boolean success;
239
240 format_desc->unpack_rgba_float(&unpacked[0][0][0], sizeof unpacked[0],
241 test->packed, 0,
242 format_desc->block.width, format_desc->block.height);
243
244 success = TRUE;
245 for (i = 0; i < format_desc->block.height; ++i) {
246 for (j = 0; j < format_desc->block.width; ++j) {
247 for (k = 0; k < 4; ++k) {
248 if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
249 success = FALSE;
250 }
251 }
252 }
253 }
254
255 if (!success) {
256 print_unpacked_rgba_float(format_desc, "FAILED: ", unpacked, " obtained\n");
257 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
258 }
259
260 return success;
261 }
262
263
264 static boolean
265 test_format_pack_rgba_float(const struct util_format_description *format_desc,
266 const struct util_format_test_case *test)
267 {
268 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
269 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
270 unsigned i, j, k;
271 boolean success;
272
273 if (test->format == PIPE_FORMAT_DXT1_RGBA) {
274 /*
275 * Skip S3TC as packed representation is not canonical.
276 *
277 * TODO: Do a round trip conversion.
278 */
279 return TRUE;
280 }
281
282 memset(packed, 0, sizeof packed);
283 for (i = 0; i < format_desc->block.height; ++i) {
284 for (j = 0; j < format_desc->block.width; ++j) {
285 for (k = 0; k < 4; ++k) {
286 unpacked[i][j][k] = (float) test->unpacked[i][j][k];
287 }
288 }
289 }
290
291 format_desc->pack_rgba_float(packed, 0,
292 &unpacked[0][0][0], sizeof unpacked[0],
293 format_desc->block.width, format_desc->block.height);
294
295 success = TRUE;
296 for (i = 0; i < format_desc->block.bits/8; ++i)
297 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
298 success = FALSE;
299
300 if (!success) {
301 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
302 print_packed(format_desc, " ", test->packed, " expected\n");
303 }
304
305 return success;
306 }
307
308
309 static boolean
310 convert_float_to_8unorm(uint8_t *dst, const double *src)
311 {
312 unsigned i;
313 boolean accurate = TRUE;
314
315 for (i = 0; i < UTIL_FORMAT_MAX_UNPACKED_HEIGHT*UTIL_FORMAT_MAX_UNPACKED_WIDTH*4; ++i) {
316 if (src[i] < 0.0) {
317 accurate = FALSE;
318 dst[i] = 0;
319 }
320 else if (src[i] > 1.0) {
321 accurate = FALSE;
322 dst[i] = 255;
323 }
324 else {
325 dst[i] = src[i] * 255.0;
326 }
327 }
328
329 return accurate;
330 }
331
332
333 static boolean
334 test_format_unpack_rgba_8unorm(const struct util_format_description *format_desc,
335 const struct util_format_test_case *test)
336 {
337 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
338 uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
339 unsigned i, j, k;
340 boolean success;
341
342 format_desc->unpack_rgba_8unorm(&unpacked[0][0][0], sizeof unpacked[0],
343 test->packed, 0,
344 format_desc->block.width, format_desc->block.height);
345
346 convert_float_to_8unorm(&expected[0][0][0], &test->unpacked[0][0][0]);
347
348 success = TRUE;
349 for (i = 0; i < format_desc->block.height; ++i) {
350 for (j = 0; j < format_desc->block.width; ++j) {
351 for (k = 0; k < 4; ++k) {
352 if (expected[i][j][k] != unpacked[i][j][k]) {
353 success = FALSE;
354 }
355 }
356 }
357 }
358
359 if (!success) {
360 print_unpacked_rgba_8unorm(format_desc, "FAILED: ", unpacked, " obtained\n");
361 print_unpacked_rgba_8unorm(format_desc, " ", expected, " expected\n");
362 }
363
364 return success;
365 }
366
367
368 static boolean
369 test_format_pack_rgba_8unorm(const struct util_format_description *format_desc,
370 const struct util_format_test_case *test)
371 {
372 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
373 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
374 unsigned i;
375 boolean success;
376
377 if (test->format == PIPE_FORMAT_DXT1_RGBA) {
378 /*
379 * Skip S3TC as packed representation is not canonical.
380 *
381 * TODO: Do a round trip conversion.
382 */
383 return TRUE;
384 }
385
386 if (!convert_float_to_8unorm(&unpacked[0][0][0], &test->unpacked[0][0][0])) {
387 /*
388 * Skip test cases which cannot be represented by four unorm bytes.
389 */
390 return TRUE;
391 }
392
393 memset(packed, 0, sizeof packed);
394
395 format_desc->pack_rgba_8unorm(packed, 0,
396 &unpacked[0][0][0], sizeof unpacked[0],
397 format_desc->block.width, format_desc->block.height);
398
399 success = TRUE;
400 for (i = 0; i < format_desc->block.bits/8; ++i)
401 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
402 success = FALSE;
403
404 if (!success) {
405 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
406 print_packed(format_desc, " ", test->packed, " expected\n");
407 }
408
409 return success;
410 }
411
412
413 static boolean
414 test_format_unpack_z_float(const struct util_format_description *format_desc,
415 const struct util_format_test_case *test)
416 {
417 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
418 unsigned i, j;
419 boolean success;
420
421 format_desc->unpack_z_float(&unpacked[0][0], sizeof unpacked[0],
422 test->packed, 0,
423 format_desc->block.width, format_desc->block.height);
424
425 success = TRUE;
426 for (i = 0; i < format_desc->block.height; ++i) {
427 for (j = 0; j < format_desc->block.width; ++j) {
428 if (!compare_float(test->unpacked[i][j][0], unpacked[i][j])) {
429 success = FALSE;
430 }
431 }
432 }
433
434 if (!success) {
435 print_unpacked_z_float(format_desc, "FAILED: ", unpacked, " obtained\n");
436 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
437 }
438
439 return success;
440 }
441
442
443 static boolean
444 test_format_pack_z_float(const struct util_format_description *format_desc,
445 const struct util_format_test_case *test)
446 {
447 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
448 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
449 unsigned i, j;
450 boolean success;
451
452 memset(packed, 0, sizeof packed);
453 for (i = 0; i < format_desc->block.height; ++i) {
454 for (j = 0; j < format_desc->block.width; ++j) {
455 unpacked[i][j] = (float) test->unpacked[i][j][0];
456 if (test->unpacked[i][j][1]) {
457 return TRUE;
458 }
459 }
460 }
461
462 format_desc->pack_z_float(packed, 0,
463 &unpacked[0][0], sizeof unpacked[0],
464 format_desc->block.width, format_desc->block.height);
465
466 success = TRUE;
467 for (i = 0; i < format_desc->block.bits/8; ++i)
468 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
469 success = FALSE;
470
471 if (!success) {
472 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
473 print_packed(format_desc, " ", test->packed, " expected\n");
474 }
475
476 return success;
477 }
478
479
480 static boolean
481 test_format_unpack_z_32unorm(const struct util_format_description *format_desc,
482 const struct util_format_test_case *test)
483 {
484 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
485 uint32_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
486 unsigned i, j;
487 boolean success;
488
489 format_desc->unpack_z_32unorm(&unpacked[0][0], sizeof unpacked[0],
490 test->packed, 0,
491 format_desc->block.width, format_desc->block.height);
492
493 for (i = 0; i < format_desc->block.height; ++i) {
494 for (j = 0; j < format_desc->block.width; ++j) {
495 expected[i][j] = test->unpacked[i][j][0] * 0xffffffff;
496 }
497 }
498
499 success = TRUE;
500 for (i = 0; i < format_desc->block.height; ++i) {
501 for (j = 0; j < format_desc->block.width; ++j) {
502 if (expected[i][j] != unpacked[i][j]) {
503 success = FALSE;
504 }
505 }
506 }
507
508 if (!success) {
509 print_unpacked_z_32unorm(format_desc, "FAILED: ", unpacked, " obtained\n");
510 print_unpacked_z_32unorm(format_desc, " ", expected, " expected\n");
511 }
512
513 return success;
514 }
515
516
517 static boolean
518 test_format_pack_z_32unorm(const struct util_format_description *format_desc,
519 const struct util_format_test_case *test)
520 {
521 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
522 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
523 unsigned i, j;
524 boolean success;
525
526 for (i = 0; i < format_desc->block.height; ++i) {
527 for (j = 0; j < format_desc->block.width; ++j) {
528 unpacked[i][j] = test->unpacked[i][j][0] * 0xffffffff;
529 if (test->unpacked[i][j][1]) {
530 return TRUE;
531 }
532 }
533 }
534
535 memset(packed, 0, sizeof packed);
536
537 format_desc->pack_z_32unorm(packed, 0,
538 &unpacked[0][0], sizeof unpacked[0],
539 format_desc->block.width, format_desc->block.height);
540
541 success = TRUE;
542 for (i = 0; i < format_desc->block.bits/8; ++i)
543 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
544 success = FALSE;
545
546 if (!success) {
547 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
548 print_packed(format_desc, " ", test->packed, " expected\n");
549 }
550
551 return success;
552 }
553
554
555 static boolean
556 test_format_unpack_s_8uscaled(const struct util_format_description *format_desc,
557 const struct util_format_test_case *test)
558 {
559 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
560 uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
561 unsigned i, j;
562 boolean success;
563
564 format_desc->unpack_s_8uscaled(&unpacked[0][0], sizeof unpacked[0],
565 test->packed, 0,
566 format_desc->block.width, format_desc->block.height);
567
568 for (i = 0; i < format_desc->block.height; ++i) {
569 for (j = 0; j < format_desc->block.width; ++j) {
570 expected[i][j] = test->unpacked[i][j][1];
571 }
572 }
573
574 success = TRUE;
575 for (i = 0; i < format_desc->block.height; ++i) {
576 for (j = 0; j < format_desc->block.width; ++j) {
577 if (expected[i][j] != unpacked[i][j]) {
578 success = FALSE;
579 }
580 }
581 }
582
583 if (!success) {
584 print_unpacked_s_8uscaled(format_desc, "FAILED: ", unpacked, " obtained\n");
585 print_unpacked_s_8uscaled(format_desc, " ", expected, " expected\n");
586 }
587
588 return success;
589 }
590
591
592 static boolean
593 test_format_pack_s_8uscaled(const struct util_format_description *format_desc,
594 const struct util_format_test_case *test)
595 {
596 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
597 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
598 unsigned i, j;
599 boolean success;
600
601 for (i = 0; i < format_desc->block.height; ++i) {
602 for (j = 0; j < format_desc->block.width; ++j) {
603 unpacked[i][j] = test->unpacked[i][j][1];
604 if (test->unpacked[i][j][0]) {
605 return TRUE;
606 }
607 }
608 }
609
610 memset(packed, 0, sizeof packed);
611
612 format_desc->pack_s_8uscaled(packed, 0,
613 &unpacked[0][0], sizeof unpacked[0],
614 format_desc->block.width, format_desc->block.height);
615
616 success = TRUE;
617 for (i = 0; i < format_desc->block.bits/8; ++i)
618 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
619 success = FALSE;
620
621 if (!success) {
622 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
623 print_packed(format_desc, " ", test->packed, " expected\n");
624 }
625
626 return success;
627 }
628
629
630 typedef boolean
631 (*test_func_t)(const struct util_format_description *format_desc,
632 const struct util_format_test_case *test);
633
634
635 static boolean
636 test_one_func(const struct util_format_description *format_desc,
637 test_func_t func,
638 const char *suffix)
639 {
640 unsigned i;
641 bool success = TRUE;
642
643 printf("Testing util_format_%s_%s ...\n",
644 format_desc->short_name, suffix);
645 fflush(stdout);
646
647 for (i = 0; i < util_format_nr_test_cases; ++i) {
648 const struct util_format_test_case *test = &util_format_test_cases[i];
649
650 if (test->format == format_desc->format) {
651 if (!func(format_desc, &util_format_test_cases[i])) {
652 success = FALSE;
653 }
654 }
655 }
656
657 return success;
658 }
659
660
661 static boolean
662 test_all(void)
663 {
664 enum pipe_format format;
665 bool success = TRUE;
666
667 for (format = 1; format < PIPE_FORMAT_COUNT; ++format) {
668 const struct util_format_description *format_desc;
669
670 format_desc = util_format_description(format);
671 if (!format_desc) {
672 continue;
673 }
674
675 if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
676 !util_format_s3tc_enabled) {
677 continue;
678 }
679
680 # define TEST_ONE_FUNC(name) \
681 if (format_desc->name) { \
682 if (!test_one_func(format_desc, &test_format_##name, #name)) { \
683 success = FALSE; \
684 } \
685 }
686
687 TEST_ONE_FUNC(fetch_rgba_float);
688 TEST_ONE_FUNC(pack_rgba_float);
689 TEST_ONE_FUNC(unpack_rgba_float);
690 TEST_ONE_FUNC(pack_rgba_8unorm);
691 TEST_ONE_FUNC(unpack_rgba_8unorm);
692
693 TEST_ONE_FUNC(unpack_z_32unorm);
694 TEST_ONE_FUNC(pack_z_32unorm);
695 TEST_ONE_FUNC(unpack_z_float);
696 TEST_ONE_FUNC(pack_z_float);
697 TEST_ONE_FUNC(unpack_s_8uscaled);
698 TEST_ONE_FUNC(pack_s_8uscaled);
699
700 # undef TEST_ONE_FUNC
701 }
702
703 return success;
704 }
705
706
707 int main(int argc, char **argv)
708 {
709 boolean success;
710
711 util_format_s3tc_init();
712
713 success = test_all();
714
715 return success ? 0 : 1;
716 }