[Piglit] [PATCH 03/13] shader_runner: Add new func version_compare()
Chad Versace
chad.versace at linux.intel.com
Mon Dec 3 21:59:31 PST 2012
The new function compares two `struct version`.
This patch replaces raw comparisons of version numbers with calls to the
new function.
We will need this function when `struct version` begins representing ES
versions.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/shaders/shader_runner.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 5962b13..e701cc2 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -118,6 +118,9 @@ enum comparison {
less_equal
};
+bool
+compare(float ref, float value, enum comparison cmp);
+
static void
version_init(struct version *v, enum version_tag tag, unsigned num)
{
@@ -133,6 +136,14 @@ version_copy(struct version *dest, struct version *src)
memcpy(dest, src, sizeof(*dest));
}
+static bool
+version_compare(struct version *a, struct version *b, enum comparison cmp)
+{
+ assert(a->_tag == b->_tag);
+
+ return compare(a->num, b->num, cmp);
+}
+
static GLboolean
string_match(const char *string, const char *line)
{
@@ -510,7 +521,7 @@ process_requirement(const char *line)
piglit_report_result(PIGLIT_FAIL);
}
- if (!compare(glsl_req_version.num, glsl_version.num, cmp)) {
+ if (!version_compare(&glsl_req_version, &glsl_version, cmp)) {
printf("Test requires GLSL version %s %d.%d. "
"Actual version is %d.%d.\n",
comparison_string(cmp),
@@ -525,7 +536,7 @@ process_requirement(const char *line)
parse_version_comparison(line + 2, &cmp, &gl_req_version,
VERSION_GL);
- if (!compare(gl_req_version.num, gl_version.num, cmp)) {
+ if (!version_compare(&gl_req_version, &gl_version, cmp)) {
printf("Test requires GL version %s %d.%d. "
"Actual version is %d.%d.\n",
comparison_string(cmp),
--
1.7.11.7
More information about the Piglit
mailing list