util: Reorder format tests -- group by format.
This commit is contained in:
parent
d3808b1b1f
commit
b1cfc195bb
|
@ -349,31 +349,20 @@ typedef boolean
|
||||||
|
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
test_one(test_func_t func, const char *suffix)
|
test_one_func(const struct util_format_description *format_desc,
|
||||||
|
test_func_t func,
|
||||||
|
const char *suffix)
|
||||||
{
|
{
|
||||||
enum pipe_format last_format = PIPE_FORMAT_NONE;
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
bool success = TRUE;
|
bool success = TRUE;
|
||||||
|
|
||||||
|
printf("Testing util_format_%s_%s ...\n",
|
||||||
|
format_desc->short_name, suffix);
|
||||||
|
|
||||||
for (i = 0; i < util_format_nr_test_cases; ++i) {
|
for (i = 0; i < util_format_nr_test_cases; ++i) {
|
||||||
const struct util_format_test_case *test = &util_format_test_cases[i];
|
const struct util_format_test_case *test = &util_format_test_cases[i];
|
||||||
const struct util_format_description *format_desc;
|
|
||||||
bool skip = FALSE;
|
|
||||||
|
|
||||||
format_desc = util_format_description(test->format);
|
if (test->format == format_desc->format) {
|
||||||
|
|
||||||
if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
|
|
||||||
!util_format_s3tc_enabled) {
|
|
||||||
skip = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (test->format != last_format) {
|
|
||||||
printf("%s util_format_%s_%s ...\n",
|
|
||||||
skip ? "Skipping" : "Testing", format_desc->short_name, suffix);
|
|
||||||
last_format = test->format;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!skip) {
|
|
||||||
if (!func(format_desc, &util_format_test_cases[i])) {
|
if (!func(format_desc, &util_format_test_cases[i])) {
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -387,22 +376,37 @@ test_one(test_func_t func, const char *suffix)
|
||||||
static boolean
|
static boolean
|
||||||
test_all(void)
|
test_all(void)
|
||||||
{
|
{
|
||||||
|
enum pipe_format format;
|
||||||
bool success = TRUE;
|
bool success = TRUE;
|
||||||
|
|
||||||
if (!test_one(&test_format_fetch_rgba_float, "fetch_rgba_float"))
|
for (format = 1; format < PIPE_FORMAT_COUNT; ++format) {
|
||||||
success = FALSE;
|
const struct util_format_description *format_desc;
|
||||||
|
|
||||||
if (!test_one(&test_format_pack_rgba_float, "pack_rgba_float"))
|
format_desc = util_format_description(format);
|
||||||
success = FALSE;
|
if (!format_desc) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!test_one(&test_format_unpack_rgba_float, "unpack_rgba_float"))
|
if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
|
||||||
success = FALSE;
|
!util_format_s3tc_enabled) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!test_one(&test_format_pack_rgba_8unorm, "pack_rgba_8unorm"))
|
# define TEST_ONE_FUNC(name) \
|
||||||
success = FALSE;
|
if (format_desc->name) { \
|
||||||
|
if (!test_one_func(format_desc, &test_format_##name, #name)) { \
|
||||||
|
success = FALSE; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
if (!test_one(&test_format_unpack_rgba_8unorm, "unpack_rgba_8unorm"))
|
TEST_ONE_FUNC(fetch_rgba_float);
|
||||||
success = FALSE;
|
TEST_ONE_FUNC(pack_rgba_float);
|
||||||
|
TEST_ONE_FUNC(unpack_rgba_float);
|
||||||
|
TEST_ONE_FUNC(pack_rgba_8unorm);
|
||||||
|
TEST_ONE_FUNC(unpack_rgba_8unorm);
|
||||||
|
|
||||||
|
# undef TEST_ONE_FUNC
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,6 @@ def write_format_table(formats):
|
||||||
print " case %s:" % format.name
|
print " case %s:" % format.name
|
||||||
print " return &util_format_%s_description;" % (format.short_name(),)
|
print " return &util_format_%s_description;" % (format.short_name(),)
|
||||||
print " default:"
|
print " default:"
|
||||||
print " assert(0);"
|
|
||||||
print " return NULL;"
|
print " return NULL;"
|
||||||
print " }"
|
print " }"
|
||||||
print "}"
|
print "}"
|
||||||
|
|
Loading…
Reference in New Issue