diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2012-11-09 17:57:52 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2012-11-16 16:07:02 -0800 |
commit | f75e72465ec65e9306f3838ed0e890c7e2ae3e06 (patch) | |
tree | b14410ee59628dff2fae132c28bc140f12f00848 | |
parent | fe8485966cffc0cfb05d2bb336f17746f77a91e1 (diff) |
shader_runner: Refactor version comparisons
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | tests/shaders/shader_runner.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index f0037c1e..db6a9d41 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -379,6 +379,15 @@ process_comparison(const char *src, enum comparison *cmp) } +void +parse_version_comparison(const char *line, enum comparison *cmp, + float *version) +{ + line = eat_whitespace(line); + line = process_comparison(line, cmp); + *version = strtod(line, NULL); +} + /** * Parse and check a line from the requirement section of the test */ @@ -443,9 +452,7 @@ process_requirement(const char *line) } else if (string_match("GLSL", line)) { enum comparison cmp; - line = eat_whitespace(line + 4); - - line = process_comparison(line, &cmp); + parse_version_comparison(line + 4, &cmp, &glsl_req_version); /* We only allow >= because we potentially use the * version number to insert a #version directive. */ @@ -454,7 +461,6 @@ process_requirement(const char *line) piglit_report_result(PIGLIT_FAIL); } - glsl_req_version = strtod(line, NULL); if (!compare(glsl_req_version, glsl_version, cmp)) { printf("Test requires GLSL version %s %.1f. " "Actual version is %.1f.\n", @@ -467,11 +473,8 @@ process_requirement(const char *line) enum comparison cmp; float version; - line = eat_whitespace(line + 2); - - line = process_comparison(line, &cmp); + parse_version_comparison(line + 2, &cmp, &version); - version = strtod(line, NULL); if (!compare(version, gl_version, cmp)) { printf("Test requires GL version %s %.1f. " "Actual version is %.1f.\n", |