From 39cd4f7ceb09dc3050f93d1fb326faf24c11150e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 11 Aug 2010 22:26:57 +0200 Subject: [PATCH] translate_test: fix segfault on x86-64 --- src/gallium/tests/unit/translate_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/tests/unit/translate_test.c b/src/gallium/tests/unit/translate_test.c index a934a6abf46..097a5fd9371 100644 --- a/src/gallium/tests/unit/translate_test.c +++ b/src/gallium/tests/unit/translate_test.c @@ -128,7 +128,7 @@ int main(int argc, char** argv) for (output_format = 1; output_format < PIPE_FORMAT_COUNT; ++output_format) { const struct util_format_description* output_format_desc = util_format_description(output_format); - unsigned output_format_size = util_format_get_stride(output_format, 1); + unsigned output_format_size; if (!output_format_desc || !output_format_desc->fetch_rgba_float || !output_format_desc->pack_rgba_float @@ -137,10 +137,12 @@ int main(int argc, char** argv) || !translate_is_output_format_supported(output_format)) continue; + output_format_size = util_format_get_stride(output_format, 1); + for (input_format = 1; input_format < PIPE_FORMAT_COUNT; ++input_format) { const struct util_format_description* input_format_desc = util_format_description(input_format); - unsigned input_format_size = util_format_get_stride(input_format, 1); + unsigned input_format_size; struct translate* translate[2]; unsigned fail = 0; unsigned used_generic = 0; @@ -153,6 +155,8 @@ int main(int argc, char** argv) || !translate_is_output_format_supported(input_format)) continue; + input_format_size = util_format_get_stride(input_format, 1); + key.element[0].input_format = input_format; key.element[0].output_format = output_format; key.output_stride = output_format_size; -- 2.30.2