added surface.c and made some changes in device.c
[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 }
71
72
73 static void
74 print_unpacked_rgba_doubl(const struct util_format_description *format_desc,
75 const char *prefix,
76 const double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
77 const char *suffix)
78 {
79 unsigned i, j;
80 const char *sep = "";
81
82 printf("%s", prefix);
83 for (i = 0; i < format_desc->block.height; ++i) {
84 for (j = 0; j < format_desc->block.width; ++j) {
85 printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
86 sep = ", ";
87 }
88 sep = ",\n";
89 }
90 printf("%s", suffix);
91 }
92
93
94 static void
95 print_unpacked_rgba_float(const struct util_format_description *format_desc,
96 const char *prefix,
97 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
98 const char *suffix)
99 {
100 unsigned i, j;
101 const char *sep = "";
102
103 printf("%s", prefix);
104 for (i = 0; i < format_desc->block.height; ++i) {
105 for (j = 0; j < format_desc->block.width; ++j) {
106 printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
107 sep = ", ";
108 }
109 sep = ",\n";
110 }
111 printf("%s", suffix);
112 }
113
114
115 static void
116 print_unpacked_rgba_8unorm(const struct util_format_description *format_desc,
117 const char *prefix,
118 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
119 const char *suffix)
120 {
121 unsigned i, j;
122 const char *sep = "";
123
124 printf("%s", prefix);
125 for (i = 0; i < format_desc->block.height; ++i) {
126 for (j = 0; j < format_desc->block.width; ++j) {
127 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]);
128 sep = ", ";
129 }
130 }
131 printf("%s", suffix);
132 }
133
134
135 static void
136 print_unpacked_z_float(const struct util_format_description *format_desc,
137 const char *prefix,
138 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
139 const char *suffix)
140 {
141 unsigned i, j;
142 const char *sep = "";
143
144 printf("%s", prefix);
145 for (i = 0; i < format_desc->block.height; ++i) {
146 for (j = 0; j < format_desc->block.width; ++j) {
147 printf("%s%f", sep, unpacked[i][j]);
148 sep = ", ";
149 }
150 sep = ",\n";
151 }
152 printf("%s", suffix);
153 }
154
155
156 static void
157 print_unpacked_z_32unorm(const struct util_format_description *format_desc,
158 const char *prefix,
159 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
160 const char *suffix)
161 {
162 unsigned i, j;
163 const char *sep = "";
164
165 printf("%s", prefix);
166 for (i = 0; i < format_desc->block.height; ++i) {
167 for (j = 0; j < format_desc->block.width; ++j) {
168 printf("%s0x%08x", sep, unpacked[i][j]);
169 sep = ", ";
170 }
171 }
172 printf("%s", suffix);
173 }
174
175
176 static void
177 print_unpacked_s_8uscaled(const struct util_format_description *format_desc,
178 const char *prefix,
179 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH],
180 const char *suffix)
181 {
182 unsigned i, j;
183 const char *sep = "";
184
185 printf("%s", prefix);
186 for (i = 0; i < format_desc->block.height; ++i) {
187 for (j = 0; j < format_desc->block.width; ++j) {
188 printf("%s0x%02x", sep, unpacked[i][j]);
189 sep = ", ";
190 }
191 }
192 printf("%s", suffix);
193 }
194
195
196 static boolean
197 test_format_fetch_rgba_float(const struct util_format_description *format_desc,
198 const struct util_format_test_case *test)
199 {
200 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
201 unsigned i, j, k;
202 boolean success;
203
204 success = TRUE;
205 for (i = 0; i < format_desc->block.height; ++i) {
206 for (j = 0; j < format_desc->block.width; ++j) {
207 format_desc->fetch_rgba_float(unpacked[i][j], test->packed, j, i);
208 for (k = 0; k < 4; ++k) {
209 if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
210 success = FALSE;
211 }
212 }
213 }
214 }
215
216 if (!success) {
217 print_unpacked_rgba_float(format_desc, "FAILED: ", unpacked, " obtained\n");
218 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
219 }
220
221 return success;
222 }
223
224
225 static boolean
226 test_format_unpack_rgba_float(const struct util_format_description *format_desc,
227 const struct util_format_test_case *test)
228 {
229 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
230 unsigned i, j, k;
231 boolean success;
232
233 format_desc->unpack_rgba_float(&unpacked[0][0][0], sizeof unpacked[0],
234 test->packed, 0,
235 format_desc->block.width, format_desc->block.height);
236
237 success = TRUE;
238 for (i = 0; i < format_desc->block.height; ++i) {
239 for (j = 0; j < format_desc->block.width; ++j) {
240 for (k = 0; k < 4; ++k) {
241 if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
242 success = FALSE;
243 }
244 }
245 }
246 }
247
248 if (!success) {
249 print_unpacked_rgba_float(format_desc, "FAILED: ", unpacked, " obtained\n");
250 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
251 }
252
253 return success;
254 }
255
256
257 static boolean
258 test_format_pack_rgba_float(const struct util_format_description *format_desc,
259 const struct util_format_test_case *test)
260 {
261 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
262 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
263 unsigned i, j, k;
264 boolean success;
265
266 if (test->format == PIPE_FORMAT_DXT1_RGBA) {
267 /*
268 * Skip S3TC as packed representation is not canonical.
269 *
270 * TODO: Do a round trip conversion.
271 */
272 return TRUE;
273 }
274
275 memset(packed, 0, sizeof packed);
276 for (i = 0; i < format_desc->block.height; ++i) {
277 for (j = 0; j < format_desc->block.width; ++j) {
278 for (k = 0; k < 4; ++k) {
279 unpacked[i][j][k] = (float) test->unpacked[i][j][k];
280 }
281 }
282 }
283
284 format_desc->pack_rgba_float(packed, 0,
285 &unpacked[0][0][0], sizeof unpacked[0],
286 format_desc->block.width, format_desc->block.height);
287
288 success = TRUE;
289 for (i = 0; i < format_desc->block.bits/8; ++i)
290 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
291 success = FALSE;
292
293 if (!success) {
294 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
295 print_packed(format_desc, " ", test->packed, " expected\n");
296 }
297
298 return success;
299 }
300
301
302 static boolean
303 convert_float_to_8unorm(uint8_t *dst, const double *src)
304 {
305 unsigned i;
306 boolean accurate = TRUE;
307
308 for (i = 0; i < UTIL_FORMAT_MAX_UNPACKED_HEIGHT*UTIL_FORMAT_MAX_UNPACKED_WIDTH*4; ++i) {
309 if (src[i] < 0.0) {
310 accurate = FALSE;
311 dst[i] = 0;
312 }
313 else if (src[i] > 1.0) {
314 accurate = FALSE;
315 dst[i] = 255;
316 }
317 else {
318 dst[i] = src[i] * 255.0;
319 }
320 }
321
322 return accurate;
323 }
324
325
326 static boolean
327 test_format_unpack_rgba_8unorm(const struct util_format_description *format_desc,
328 const struct util_format_test_case *test)
329 {
330 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
331 uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
332 unsigned i, j, k;
333 boolean success;
334
335 format_desc->unpack_rgba_8unorm(&unpacked[0][0][0], sizeof unpacked[0],
336 test->packed, 0,
337 format_desc->block.width, format_desc->block.height);
338
339 convert_float_to_8unorm(&expected[0][0][0], &test->unpacked[0][0][0]);
340
341 success = TRUE;
342 for (i = 0; i < format_desc->block.height; ++i) {
343 for (j = 0; j < format_desc->block.width; ++j) {
344 for (k = 0; k < 4; ++k) {
345 if (expected[i][j][k] != unpacked[i][j][k]) {
346 success = FALSE;
347 }
348 }
349 }
350 }
351
352 if (!success) {
353 print_unpacked_rgba_8unorm(format_desc, "FAILED: ", unpacked, " obtained\n");
354 print_unpacked_rgba_8unorm(format_desc, " ", expected, " expected\n");
355 }
356
357 return success;
358 }
359
360
361 static boolean
362 test_format_pack_rgba_8unorm(const struct util_format_description *format_desc,
363 const struct util_format_test_case *test)
364 {
365 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
366 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
367 unsigned i;
368 boolean success;
369
370 if (test->format == PIPE_FORMAT_DXT1_RGBA) {
371 /*
372 * Skip S3TC as packed representation is not canonical.
373 *
374 * TODO: Do a round trip conversion.
375 */
376 return TRUE;
377 }
378
379 if (!convert_float_to_8unorm(&unpacked[0][0][0], &test->unpacked[0][0][0])) {
380 /*
381 * Skip test cases which cannot be represented by four unorm bytes.
382 */
383 return TRUE;
384 }
385
386 memset(packed, 0, sizeof packed);
387
388 format_desc->pack_rgba_8unorm(packed, 0,
389 &unpacked[0][0][0], sizeof unpacked[0],
390 format_desc->block.width, format_desc->block.height);
391
392 success = TRUE;
393 for (i = 0; i < format_desc->block.bits/8; ++i)
394 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
395 success = FALSE;
396
397 if (!success) {
398 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
399 print_packed(format_desc, " ", test->packed, " expected\n");
400 }
401
402 return success;
403 }
404
405
406 static boolean
407 test_format_unpack_z_float(const struct util_format_description *format_desc,
408 const struct util_format_test_case *test)
409 {
410 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
411 unsigned i, j;
412 boolean success;
413
414 format_desc->unpack_z_float(&unpacked[0][0], sizeof unpacked[0],
415 test->packed, 0,
416 format_desc->block.width, format_desc->block.height);
417
418 success = TRUE;
419 for (i = 0; i < format_desc->block.height; ++i) {
420 for (j = 0; j < format_desc->block.width; ++j) {
421 if (!compare_float(test->unpacked[i][j][0], unpacked[i][j])) {
422 success = FALSE;
423 }
424 }
425 }
426
427 if (!success) {
428 print_unpacked_z_float(format_desc, "FAILED: ", unpacked, " obtained\n");
429 print_unpacked_rgba_doubl(format_desc, " ", test->unpacked, " expected\n");
430 }
431
432 return success;
433 }
434
435
436 static boolean
437 test_format_pack_z_float(const struct util_format_description *format_desc,
438 const struct util_format_test_case *test)
439 {
440 float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
441 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
442 unsigned i, j;
443 boolean success;
444
445 memset(packed, 0, sizeof packed);
446 for (i = 0; i < format_desc->block.height; ++i) {
447 for (j = 0; j < format_desc->block.width; ++j) {
448 unpacked[i][j] = (float) test->unpacked[i][j][0];
449 if (test->unpacked[i][j][1]) {
450 return TRUE;
451 }
452 }
453 }
454
455 format_desc->pack_z_float(packed, 0,
456 &unpacked[0][0], sizeof unpacked[0],
457 format_desc->block.width, format_desc->block.height);
458
459 success = TRUE;
460 for (i = 0; i < format_desc->block.bits/8; ++i)
461 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
462 success = FALSE;
463
464 if (!success) {
465 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
466 print_packed(format_desc, " ", test->packed, " expected\n");
467 }
468
469 return success;
470 }
471
472
473 static boolean
474 test_format_unpack_z_32unorm(const struct util_format_description *format_desc,
475 const struct util_format_test_case *test)
476 {
477 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
478 uint32_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
479 unsigned i, j;
480 boolean success;
481
482 format_desc->unpack_z_32unorm(&unpacked[0][0], sizeof unpacked[0],
483 test->packed, 0,
484 format_desc->block.width, format_desc->block.height);
485
486 for (i = 0; i < format_desc->block.height; ++i) {
487 for (j = 0; j < format_desc->block.width; ++j) {
488 expected[i][j] = test->unpacked[i][j][0] * 0xffffffff;
489 }
490 }
491
492 success = TRUE;
493 for (i = 0; i < format_desc->block.height; ++i) {
494 for (j = 0; j < format_desc->block.width; ++j) {
495 if (expected[i][j] != unpacked[i][j]) {
496 success = FALSE;
497 }
498 }
499 }
500
501 if (!success) {
502 print_unpacked_z_32unorm(format_desc, "FAILED: ", unpacked, " obtained\n");
503 print_unpacked_z_32unorm(format_desc, " ", expected, " expected\n");
504 }
505
506 return success;
507 }
508
509
510 static boolean
511 test_format_pack_z_32unorm(const struct util_format_description *format_desc,
512 const struct util_format_test_case *test)
513 {
514 uint32_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
515 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
516 unsigned i, j;
517 boolean success;
518
519 for (i = 0; i < format_desc->block.height; ++i) {
520 for (j = 0; j < format_desc->block.width; ++j) {
521 unpacked[i][j] = test->unpacked[i][j][0] * 0xffffffff;
522 if (test->unpacked[i][j][1]) {
523 return TRUE;
524 }
525 }
526 }
527
528 memset(packed, 0, sizeof packed);
529
530 format_desc->pack_z_32unorm(packed, 0,
531 &unpacked[0][0], sizeof unpacked[0],
532 format_desc->block.width, format_desc->block.height);
533
534 success = TRUE;
535 for (i = 0; i < format_desc->block.bits/8; ++i)
536 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
537 success = FALSE;
538
539 if (!success) {
540 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
541 print_packed(format_desc, " ", test->packed, " expected\n");
542 }
543
544 return success;
545 }
546
547
548 static boolean
549 test_format_unpack_s_8uscaled(const struct util_format_description *format_desc,
550 const struct util_format_test_case *test)
551 {
552 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
553 uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH] = { { 0 } };
554 unsigned i, j;
555 boolean success;
556
557 format_desc->unpack_s_8uscaled(&unpacked[0][0], sizeof unpacked[0],
558 test->packed, 0,
559 format_desc->block.width, format_desc->block.height);
560
561 for (i = 0; i < format_desc->block.height; ++i) {
562 for (j = 0; j < format_desc->block.width; ++j) {
563 expected[i][j] = test->unpacked[i][j][1];
564 }
565 }
566
567 success = TRUE;
568 for (i = 0; i < format_desc->block.height; ++i) {
569 for (j = 0; j < format_desc->block.width; ++j) {
570 if (expected[i][j] != unpacked[i][j]) {
571 success = FALSE;
572 }
573 }
574 }
575
576 if (!success) {
577 print_unpacked_s_8uscaled(format_desc, "FAILED: ", unpacked, " obtained\n");
578 print_unpacked_s_8uscaled(format_desc, " ", expected, " expected\n");
579 }
580
581 return success;
582 }
583
584
585 static boolean
586 test_format_pack_s_8uscaled(const struct util_format_description *format_desc,
587 const struct util_format_test_case *test)
588 {
589 uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH];
590 uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
591 unsigned i, j;
592 boolean success;
593
594 for (i = 0; i < format_desc->block.height; ++i) {
595 for (j = 0; j < format_desc->block.width; ++j) {
596 unpacked[i][j] = test->unpacked[i][j][1];
597 if (test->unpacked[i][j][0]) {
598 return TRUE;
599 }
600 }
601 }
602
603 memset(packed, 0, sizeof packed);
604
605 format_desc->pack_s_8uscaled(packed, 0,
606 &unpacked[0][0], sizeof unpacked[0],
607 format_desc->block.width, format_desc->block.height);
608
609 success = TRUE;
610 for (i = 0; i < format_desc->block.bits/8; ++i)
611 if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
612 success = FALSE;
613
614 if (!success) {
615 print_packed(format_desc, "FAILED: ", packed, " obtained\n");
616 print_packed(format_desc, " ", test->packed, " expected\n");
617 }
618
619 return success;
620 }
621
622
623 typedef boolean
624 (*test_func_t)(const struct util_format_description *format_desc,
625 const struct util_format_test_case *test);
626
627
628 static boolean
629 test_one_func(const struct util_format_description *format_desc,
630 test_func_t func,
631 const char *suffix)
632 {
633 unsigned i;
634 bool success = TRUE;
635
636 printf("Testing util_format_%s_%s ...\n",
637 format_desc->short_name, suffix);
638
639 for (i = 0; i < util_format_nr_test_cases; ++i) {
640 const struct util_format_test_case *test = &util_format_test_cases[i];
641
642 if (test->format == format_desc->format) {
643 if (!func(format_desc, &util_format_test_cases[i])) {
644 success = FALSE;
645 }
646 }
647 }
648
649 return success;
650 }
651
652
653 static boolean
654 test_all(void)
655 {
656 enum pipe_format format;
657 bool success = TRUE;
658
659 for (format = 1; format < PIPE_FORMAT_COUNT; ++format) {
660 const struct util_format_description *format_desc;
661
662 format_desc = util_format_description(format);
663 if (!format_desc) {
664 continue;
665 }
666
667 if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
668 !util_format_s3tc_enabled) {
669 continue;
670 }
671
672 # define TEST_ONE_FUNC(name) \
673 if (format_desc->name) { \
674 if (!test_one_func(format_desc, &test_format_##name, #name)) { \
675 success = FALSE; \
676 } \
677 }
678
679 TEST_ONE_FUNC(fetch_rgba_float);
680 TEST_ONE_FUNC(pack_rgba_float);
681 TEST_ONE_FUNC(unpack_rgba_float);
682 TEST_ONE_FUNC(pack_rgba_8unorm);
683 TEST_ONE_FUNC(unpack_rgba_8unorm);
684
685 TEST_ONE_FUNC(unpack_z_32unorm);
686 TEST_ONE_FUNC(pack_z_32unorm);
687 TEST_ONE_FUNC(unpack_z_float);
688 TEST_ONE_FUNC(pack_z_float);
689 TEST_ONE_FUNC(unpack_s_8uscaled);
690 TEST_ONE_FUNC(pack_s_8uscaled);
691
692 # undef TEST_ONE_FUNC
693 }
694
695 return success;
696 }
697
698
699 int main(int argc, char **argv)
700 {
701 boolean success;
702
703 util_format_s3tc_init();
704
705 success = test_all();
706
707 return success ? 0 : 1;
708 }