aboutsummaryrefslogtreecommitdiff
path: root/tests/shaders
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-12-03 14:47:21 -0800
committerChad Versace <chad.versace@linux.intel.com>2012-12-11 12:44:50 -0600
commitd8034219f7a410e060591e1bcfc48a724925a0e3 (patch)
tree263ae184ae5e0698aa5fc054ce81f5d9b205bc4c /tests/shaders
parent7ef9ac19f5add272b7e31e41f24799d4e610fdfc (diff)
shader_runner: Add new func version_compare()
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@linux.intel.com>
Diffstat (limited to 'tests/shaders')
-rw-r--r--tests/shaders/shader_runner.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 5962b132..e701cc21 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),