diff options
author | Paul Berry <stereotype441@gmail.com> | 2012-06-04 13:09:09 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2012-06-07 10:58:22 -0700 |
commit | 275d864425d30b944318d663e9b251b49f5c8fb9 (patch) | |
tree | 17188e54c5bafb103a58396edd58a3b6cf1cdaa7 | |
parent | d7ccdb0eccdf39a1d123cd5cd3c624bc2ed9c9cd (diff) |
fbo: Make an alternate function for initializing fbo-formats.h.
This patch extracts code from fbo_formats_init() into a separate
function, fbo_formats_init_test_set(), which skips command line
parsing and simply initializes fbo-formats.h to use a particular test
set. This will allow future tests to make use of fbo-formats.h even
if they have to use different command-line parsing than what is
implemented in fbo_formats_init().
In addition, fbo_formats_init() has been changed to a non-static
function, so that if an fbo test directly calls
fbo_formats_init_test_set() instead, we won't get a spurious compile
warning about an unused function.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
-rw-r--r-- | tests/fbo/fbo-formats.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h index 8275c39f0..02bbfc7de 100644 --- a/tests/fbo/fbo-formats.h +++ b/tests/fbo/fbo-formats.h @@ -568,7 +568,8 @@ fbo_lookup_test_set(const char *test_set_name) exit(1); } -static void fbo_formats_init(int argc, char **argv, GLboolean print_options) +static void +fbo_formats_init_test_set(int test_set_index, GLboolean print_options) { if (!piglit_automatic) glutKeyboardFunc(fbo_formats_key_func); @@ -576,12 +577,7 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options) piglit_require_extension("GL_EXT_framebuffer_object"); piglit_require_extension("GL_ARB_texture_env_combine"); - if (argc == 2) { - test_index = fbo_lookup_test_set(argv[1]); - } else if (argc > 2) { - printf("More than 1 test set specified\n"); - exit(1); - } + test_index = test_set_index; if (!piglit_automatic && print_options) { printf(" -n Next test set.\n" @@ -593,6 +589,20 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options) printf("Using test set: %s\n", test_sets[test_index].param); } +void +fbo_formats_init(int argc, char **argv, GLboolean print_options) +{ + int test_set_index = 0; + if (argc == 2) { + test_set_index = fbo_lookup_test_set(argv[1]); + } else if (argc > 2) { + printf("More than 1 test set specified\n"); + exit(1); + } + + fbo_formats_init_test_set(test_set_index, print_options); +} + static void add_result(bool *all_skip, enum piglit_result *end_result, enum piglit_result new_result) { |