[Piglit] [PATCH] util/gl: Add functions piglit_test_{min, max}_int64 (v2)
Chad Versace
chad.versace at linux.intel.com
Wed Nov 28 13:31:42 PST 2012
The new functions test the min/max value of a token with glGetInteger64v.
v2: Use PRId64 for printing GLint64, for Anholt.
CC: Eric Anholt <eric at anholt.net>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
As a follow-on patch, I should probably change the width of the columns to
accomodate GLint64.
tests/util/minmax-test.c | 36 ++++++++++++++++++++++++++++++++++++
tests/util/minmax-test.h | 2 ++
2 files changed, 38 insertions(+)
diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
index 2f8e413..bcd4856 100644
--- a/tests/util/minmax-test.c
+++ b/tests/util/minmax-test.c
@@ -27,6 +27,8 @@
*/
#define _GNU_SOURCE
+
+#include <inttypes.h>
#include <string.h>
#include "piglit-util-gl-common.h"
@@ -52,6 +54,18 @@ piglit_report_int(const char *name, GLint limit, GLint val, bool pass)
}
static void
+piglit_report_int64(const char *name, GLint64 limit, GLint64 val, bool pass)
+{
+ if (pass) {
+ printf("%-50s %8"PRId64" %8"PRId64"\n", name, limit, val);
+ } else {
+ fprintf(stderr, "%-50s %8ld %8ld (ERROR)\n",
+ name, limit, val);
+ piglit_minmax_pass = false;
+ }
+}
+
+static void
piglit_report_float(const char *name, GLfloat limit, GLfloat val, bool pass)
{
if (pass) {
@@ -76,6 +90,19 @@ piglit_test_int(GLenum token, GLint limit, bool max)
(!max && val >= limit));
}
+static void
+piglit_test_int64(GLenum token, GLint64 limit, bool max)
+{
+ const char *name = piglit_get_gl_enum_name(token);
+ GLint64 val;
+
+ glGetInteger64v(token, &val);
+
+ piglit_report_int64(name, limit, val,
+ (max && val <= limit) ||
+ (!max && val >= limit));
+}
+
void piglit_test_min_int(GLenum token, GLint min)
{
piglit_test_int(token, min, false);
@@ -86,6 +113,15 @@ void piglit_test_max_int(GLenum token, GLint max)
piglit_test_int(token, max, true);
}
+void piglit_test_min_int64(GLenum token, GLint64 min)
+{
+ piglit_test_int64(token, min, false);
+}
+
+void piglit_test_max_int64(GLenum token, GLint64 max)
+{
+ piglit_test_int64(token, max, true);
+}
static void
piglit_test_float(GLenum token, GLfloat limit, bool max)
diff --git a/tests/util/minmax-test.h b/tests/util/minmax-test.h
index 986ac8d..d9baab5 100644
--- a/tests/util/minmax-test.h
+++ b/tests/util/minmax-test.h
@@ -25,6 +25,8 @@ extern bool piglit_minmax_pass;
void piglit_print_minmax_header(void);
void piglit_test_min_int(GLenum token, GLint val);
void piglit_test_max_int(GLenum token, GLint val);
+void piglit_test_min_int64(GLenum token, GLint64 min);
+void piglit_test_max_int64(GLenum token, GLint64 min);
void piglit_test_min_float(GLenum token, GLfloat val);
void piglit_test_max_float(GLenum token, GLfloat val);
void piglit_test_range_float(GLenum token, GLfloat low, GLfloat high);
--
1.7.11.7
More information about the Piglit
mailing list