[Piglit] [PATCH 4/5] gles2: add minmax test
Tom Gall
tom.gall at linaro.org
Thu Dec 20 10:54:02 PST 2012
Add minmax test based on values that can be queried as specified
in chapter 6.2 of the OpenGL ES 2.0.25 spec.
Small modification to tests/util/minmax-test.* so that functions
which use GLint64 and GLuint64 types aren't compiled when
building for OpenGL ES2.
Signed-off-by: Tom Gall <tom.gall at linaro.org>
---
tests/all.tests | 1 +
tests/spec/gles-2.0/CMakeLists.gles2.txt | 1 +
tests/spec/gles-2.0/minmax.c | 78 +++++++++++++++++++++
tests/util/CMakeLists.gles2.txt | 1 +
tests/util/minmax-test.c | 110 +++++++++++++++---------------
tests/util/minmax-test.h | 11 +--
6 files changed, 144 insertions(+), 58 deletions(-)
create mode 100644 tests/spec/gles-2.0/minmax.c
diff --git a/tests/all.tests b/tests/all.tests
index 89686c3..8db9643 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2686,6 +2686,7 @@ spec['!OpenGL ES 2.0'] = gles20
add_plain_test(gles20, 'sanity-test_gles2')
add_plain_test(gles20, 'unit-glReadPixels_gles2')
add_plain_test(gles20, 'clear-varray-2.0_gles2')
+add_concurrent_test(gles20, 'minmax_gles2')
gles30 = Group()
spec['!OpenGL ES 3.0'] = gles30
diff --git a/tests/spec/gles-2.0/CMakeLists.gles2.txt b/tests/spec/gles-2.0/CMakeLists.gles2.txt
index 02e073c..8e9be85 100644
--- a/tests/spec/gles-2.0/CMakeLists.gles2.txt
+++ b/tests/spec/gles-2.0/CMakeLists.gles2.txt
@@ -6,5 +6,6 @@ piglit_add_executable(sanity-test_${piglit_target_api} gles2_sanity_test.c)
piglit_add_executable(invalid-es3-queries_${piglit_target_api} invalid-es3-queries.c)
piglit_add_executable(unit-glReadPixels_${piglit_target_api} gles2_unit_glReadPixels.c)
piglit_add_executable(clear-varray-2.0_${piglit_target_api} clear-varray-2.0.c)
+piglit_add_executable(minmax_${piglit_target_api} minmax.c)
# vim: ft=cmake:
diff --git a/tests/spec/gles-2.0/minmax.c b/tests/spec/gles-2.0/minmax.c
new file mode 100644
index 0000000..f67caba
--- /dev/null
+++ b/tests/spec/gles-2.0/minmax.c
@@ -0,0 +1,78 @@
+/* Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "minmax-test.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ /* Taken from es_full_spec_2.0.25, Chapture 6.2
+ * If the value's type is listed as Z in a spec table, then consider
+ * its type to be a signed int (that is, GLint). If the
+ * value's type is listed as Z^+, then consider its type to be
+ * unsigned (that is, GLuint).
+ */
+
+ piglit_print_minmax_header();
+
+ /* Table 6.18 */
+ piglit_test_min_uint(GL_SUBPIXEL_BITS, 4);
+ piglit_test_min_uint(GL_MAX_TEXTURE_SIZE, 64);
+ piglit_test_min_uint(GL_MAX_CUBE_MAP_TEXTURE_SIZE, 16);
+ piglit_test_range_float(GL_ALIASED_POINT_SIZE_RANGE, 1, 1);
+ piglit_test_range_float(GL_ALIASED_LINE_WIDTH_RANGE, 1, 1);
+ piglit_test_min_uint(GL_SAMPLE_BUFFERS, 0);
+ piglit_test_min_uint(GL_SAMPLES, 0);
+ piglit_test_min_int(GL_NUM_COMPRESSED_TEXTURE_FORMATS, 0);
+ piglit_test_min_viewport_dimensions();
+
+ /* Table 6.19 */
+ piglit_test_min_int(GL_NUM_SHADER_BINARY_FORMATS, 0);
+
+ /* Table 6.20 */
+ piglit_test_min_uint(GL_MAX_VERTEX_ATTRIBS, 8);
+ piglit_test_min_uint(GL_MAX_VERTEX_UNIFORM_VECTORS, 128);
+ piglit_test_min_uint(GL_MAX_VARYING_VECTORS, 8);
+ piglit_test_min_uint(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 8);
+ piglit_test_min_uint(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0);
+ piglit_test_min_uint(GL_MAX_TEXTURE_IMAGE_UNITS, 8);
+ piglit_test_min_uint(GL_MAX_FRAGMENT_UNIFORM_VECTORS, 16);
+ piglit_test_min_uint(GL_MAX_RENDERBUFFER_SIZE, 1);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+
+ piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/util/CMakeLists.gles2.txt b/tests/util/CMakeLists.gles2.txt
index 3df0f6b..4026b7f 100644
--- a/tests/util/CMakeLists.gles2.txt
+++ b/tests/util/CMakeLists.gles2.txt
@@ -1,5 +1,6 @@
set(UTIL_GL_SOURCES
${UTIL_GL_SOURCES}
+ minmax-test.c
piglit-shader.c
piglit-shader-gles2.c
piglit-util-gl-enum.c
diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
index 9534b18..55611d9 100644
--- a/tests/util/minmax-test.c
+++ b/tests/util/minmax-test.c
@@ -65,6 +65,7 @@ piglit_report_uint(const char *name, GLuint limit, GLuint val, bool pass)
printf("\n");
}
+#if !defined(PIGLIT_USE_OPENGL_ES2)
static void
piglit_report_int64(const char *name, GLint64 limit, GLint64 val, bool pass)
{
@@ -88,44 +89,6 @@ piglit_report_uint64(const char *name, GLuint64 limit, GLuint64 val, bool pass)
}
static void
-piglit_report_float(const char *name, GLfloat limit, GLfloat val, bool pass)
-{
- if (pass) {
- printf("%-50s %8.1f %8.1f\n", name, limit, val);
- } else {
- fprintf(stderr, "%-50s %8f %8f (ERROR)\n",
- name, limit, val);
- piglit_minmax_pass = false;
- }
-}
-
-static void
-piglit_test_int(GLenum token, GLint limit, bool max)
-{
- const char *name = piglit_get_gl_enum_name(token);
- GLint val = 9999;
-
- glGetIntegerv(token, &val);
-
- piglit_report_int(name, limit, val,
- (max && val <= limit) ||
- (!max && val >= limit));
-}
-
-static void
-piglit_test_uint(GLenum token, GLuint limit, bool max)
-{
- const char *name = piglit_get_gl_enum_name(token);
- GLuint val = 9999;
-
- glGetIntegerv(token, (GLint*) &val);
-
- piglit_report_uint(name, limit, val,
- (max && val <= limit) ||
- (!max && val >= limit));
-}
-
-static void
piglit_test_int64(GLenum token, GLint64 limit, bool max)
{
const char *name = piglit_get_gl_enum_name(token);
@@ -164,44 +127,83 @@ piglit_test_uint64(GLenum token, GLuint64 limit, bool max)
(!max && val >= limit));
}
-void piglit_test_min_int(GLenum token, GLint min)
+void piglit_test_min_int64(GLenum token, GLint64 min)
{
- piglit_test_int(token, min, false);
+ piglit_test_int64(token, min, false);
}
-void piglit_test_max_int(GLenum token, GLint max)
+void piglit_test_max_int64(GLenum token, GLint64 max)
{
- piglit_test_int(token, max, true);
+ piglit_test_int64(token, max, true);
}
-void piglit_test_min_uint(GLenum token, GLuint min)
+void piglit_test_min_uint64(GLenum token, GLuint64 min)
{
- piglit_test_uint(token, min, false);
+ piglit_test_uint64(token, min, false);
}
-void piglit_test_max_uint(GLenum token, GLuint max)
+void piglit_test_max_uint64(GLenum token, GLuint64 max)
{
- piglit_test_uint(token, max, true);
+ piglit_test_uint64(token, max, true);
}
+#endif /* PIGLIT_USE_OPENGL_ES2 */
-void piglit_test_min_int64(GLenum token, GLint64 min)
+static void
+piglit_report_float(const char *name, GLfloat limit, GLfloat val, bool pass)
{
- piglit_test_int64(token, min, false);
+ if (pass) {
+ printf("%-50s %8.1f %8.1f\n", name, limit, val);
+ } else {
+ fprintf(stderr, "%-50s %8f %8f (ERROR)\n",
+ name, limit, val);
+ piglit_minmax_pass = false;
+ }
}
-void piglit_test_max_int64(GLenum token, GLint64 max)
+static void
+piglit_test_int(GLenum token, GLint limit, bool max)
{
- piglit_test_int64(token, max, true);
+ const char *name = piglit_get_gl_enum_name(token);
+ GLint val = 9999;
+
+ glGetIntegerv(token, &val);
+
+ piglit_report_int(name, limit, val,
+ (max && val <= limit) ||
+ (!max && val >= limit));
}
-void piglit_test_min_uint64(GLenum token, GLuint64 min)
+static void
+piglit_test_uint(GLenum token, GLuint limit, bool max)
{
- piglit_test_uint64(token, min, false);
+ const char *name = piglit_get_gl_enum_name(token);
+ GLuint val = 9999;
+
+ glGetIntegerv(token, (GLint*) &val);
+
+ piglit_report_uint(name, limit, val,
+ (max && val <= limit) ||
+ (!max && val >= limit));
}
-void piglit_test_max_uint64(GLenum token, GLuint64 max)
+void piglit_test_min_int(GLenum token, GLint min)
{
- piglit_test_uint64(token, max, true);
+ piglit_test_int(token, min, false);
+}
+
+void piglit_test_max_int(GLenum token, GLint max)
+{
+ piglit_test_int(token, max, true);
+}
+
+void piglit_test_min_uint(GLenum token, GLuint min)
+{
+ piglit_test_uint(token, min, false);
+}
+
+void piglit_test_max_uint(GLenum token, GLuint max)
+{
+ piglit_test_uint(token, max, true);
}
static void
diff --git a/tests/util/minmax-test.h b/tests/util/minmax-test.h
index a261147..529ca75 100644
--- a/tests/util/minmax-test.h
+++ b/tests/util/minmax-test.h
@@ -27,15 +27,18 @@ void piglit_test_min_int(GLenum token, GLint val);
void piglit_test_max_int(GLenum token, GLint val);
void piglit_test_min_uint(GLenum token, GLuint val);
void piglit_test_max_uint(GLenum token, GLuint val);
-void piglit_test_min_int64(GLenum token, GLint64 min);
-void piglit_test_max_int64(GLenum token, GLint64 min);
-void piglit_test_min_uint64(GLenum token, GLuint64 min);
-void piglit_test_max_uint64(GLenum token, GLuint64 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);
void piglit_test_min_viewport_dimensions();
+#if !defined(PIGLIT_USE_OPENGL_ES2)
+void piglit_test_min_int64(GLenum token, GLint64 min);
+void piglit_test_max_int64(GLenum token, GLint64 min);
+void piglit_test_min_uint64(GLenum token, GLuint64 min);
+void piglit_test_max_uint64(GLenum token, GLuint64 min);
+#endif /* PIGLIT_USE_OPENGL_ES2 */
+
#ifdef PIGLIT_USE_OPENGL
void piglit_test_oq_bits(void);
void piglit_test_tf_bits(GLenum target);
--
1.7.10.4
More information about the Piglit
mailing list