[Piglit] [PATCH 01/13] Add a small API test for GLSL 1.30 exposing the texel offset limit queries.

Eric Anholt eric at anholt.net
Sat Oct 15 13:19:30 PDT 2011


The queries appear in the GL 3.0 spec, and are mentioned to be
supported in the GLSL 1.30 spec.  The GLSL 1.30 spec doesn't list the
minimum maximum and the maximum minimum we're testing here, which
somes from 3.0.
---
 tests/all.tests                            |    1 +
 tests/spec/glsl-1.30/CMakeLists.gl.txt     |   14 +++++
 tests/spec/glsl-1.30/CMakeLists.txt        |    1 +
 tests/spec/glsl-1.30/texel-offset-limits.c |   72 ++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/CMakeLists.gl.txt
 create mode 100644 tests/spec/glsl-1.30/texel-offset-limits.c

diff --git a/tests/all.tests b/tests/all.tests
index 2098e38..16f2e9e 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -862,6 +862,7 @@ add_plain_test(spec['glsl-1.30']['linker']['clipping'], 'mixing-clip-distance-an
 add_plain_test(spec['glsl-1.30']['execution']['clipping'], 'max-clip-distances')
 spec['glsl-1.30']['execution']['clipping']['clip-plane-transformation pos'] = \
     concurrent_test('clip-plane-transformation pos')
+spec['glsl-1.30']['texel-offset-limits'] = concurrent_test('glsl-1.30-texel-offset-limits')
 
 # Group AMD_conservative_depth
 spec['AMD_conservative_depth'] = Group()
diff --git a/tests/spec/glsl-1.30/CMakeLists.gl.txt b/tests/spec/glsl-1.30/CMakeLists.gl.txt
new file mode 100644
index 0000000..3ddd137
--- /dev/null
+++ b/tests/spec/glsl-1.30/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+	${OPENGL_INCLUDE_PATH}
+	${GLUT_INCLUDE_DIR}
+	${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+	piglitutil
+	${OPENGL_gl_LIBRARY}
+	${OPENGL_glu_LIBRARY}
+	${GLUT_glut_LIBRARY}
+)
+
+add_executable (glsl-1.30-texel-offset-limits texel-offset-limits.c)
diff --git a/tests/spec/glsl-1.30/CMakeLists.txt b/tests/spec/glsl-1.30/CMakeLists.txt
index 6a9b5dd..a14abba 100644
--- a/tests/spec/glsl-1.30/CMakeLists.txt
+++ b/tests/spec/glsl-1.30/CMakeLists.txt
@@ -1,2 +1,3 @@
 add_subdirectory (linker)
 add_subdirectory (execution)
+piglit_include_target_api()
diff --git a/tests/spec/glsl-1.30/texel-offset-limits.c b/tests/spec/glsl-1.30/texel-offset-limits.c
new file mode 100644
index 0000000..b562d0d
--- /dev/null
+++ b/tests/spec/glsl-1.30/texel-offset-limits.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * @file texel-offset-limits.c
+ *
+ * Tests that GLSL 1.30 exposes the GL_MIN/MAX_PROGRAM_OFFSET_LIMITS.
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 10, piglit_height = 10;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
+
+enum piglit_result
+piglit_display()
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+	GLint val;
+
+	piglit_require_GLSL_version(130);
+
+	glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &val);
+	piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
+	if (val > -8) {
+		fprintf(stderr,
+			"query of GL_MIN_PROGRAM_TEXEL_OFFSET "
+			"returned %d, must be at least -8\n",
+			val);
+		pass = false;
+	}
+
+	glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &val);
+	piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
+	if (val < 7) {
+		fprintf(stderr,
+			"query of GL_MAX_PROGRAM_TEXEL_OFFSET "
+			"returned %d, must be at least 7\n",
+			val);
+		pass = false;
+	}
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.7



More information about the Piglit mailing list