aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/shaders/shader_runner.c19
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",