[Piglit] [PATCH 07/20] Move tex1d-2border test from bugs to spec dir.

Fabian Bieler fabianbieler at fastmail.fm
Sat Dec 16 19:21:07 UTC 2017


---
 tests/all.py                        |   2 +-
 tests/bugs/CMakeLists.gl.txt        |   1 -
 tests/bugs/tex1d-2dborder.c         | 126 ------------------------------------
 tests/spec/gl-1.4/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.4/tex1d-2dborder.c  | 126 ++++++++++++++++++++++++++++++++++++
 5 files changed, 128 insertions(+), 128 deletions(-)
 delete mode 100644 tests/bugs/tex1d-2dborder.c
 create mode 100644 tests/spec/gl-1.4/tex1d-2dborder.c

diff --git a/tests/all.py b/tests/all.py
index b441feb..ef133ee 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -915,12 +915,12 @@ with profile.test_list.group_manager(
         PiglitGLTest,
         grouptools.join('spec', '!opengl 1.4')) as g:
     g(['fdo25614-genmipmap'])
-    g(['tex1d-2dborder'])
     g(['blendminmax'])
     g(['blendsquare'])
     g(['gl-1.4-dlist-multidrawarrays'])
     g(['gl-1.4-multidrawarrays-errors'])
     g(['gl-1.4-polygon-offset'])
+    g(['gl-1.4-tex1d-2dborder'])
     g(['draw-batch'])
     g(['stencil-wrap'])
     g(['triangle-rasterization'])
diff --git a/tests/bugs/CMakeLists.gl.txt b/tests/bugs/CMakeLists.gl.txt
index 96c61b4..4804ae4 100644
--- a/tests/bugs/CMakeLists.gl.txt
+++ b/tests/bugs/CMakeLists.gl.txt
@@ -10,7 +10,6 @@ link_libraries (
 	${OPENGL_gl_LIBRARY}
 )
 
-piglit_add_executable (tex1d-2dborder tex1d-2dborder.c)
 piglit_add_executable (fdo20701 fdo20701.c)
 piglit_add_executable (point-sprite point-sprite.c)
 piglit_add_executable (fdo22540 fdo22540.c)
diff --git a/tests/bugs/tex1d-2dborder.c b/tests/bugs/tex1d-2dborder.c
deleted file mode 100644
index a83ba04..0000000
--- a/tests/bugs/tex1d-2dborder.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) The Piglit project 2008
- *
- * 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
- * VA LINUX SYSTEM, IBM 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
- * Test whether 1D textures correctly ignore the T coordinate wrap mode.
- *
- * Since 1D textures are genuine one-dimensional objects, the T coordinate
- * shouldn't affect them at all. However, R300 simulates them as flat
- * 2D textures, which caused incorrect sampling of border colors.
- */
-
-#include "piglit-util-gl.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-
-	config.window_width = 256;
-	config.window_height = 128;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-	config.khr_no_error_support = PIGLIT_NO_ERRORS;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-static const GLfloat TextureColor[3] = { 1.0, 0.5, 0.0 };
-
-
-static GLboolean test(GLenum wrapt, int cellx, int celly)
-{
-	int sx, sy;
-
-	glPushMatrix();
-	glTranslatef(cellx*0.25, celly*0.5, 0.0);
-	glScalef(0.25, 0.5, 1.0);
-	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, wrapt);
-	glBegin(GL_QUADS);
-		glTexCoord2f(0, 0); glVertex2f(0, 0);
-		glTexCoord2f(1, 0); glVertex2f(1, 0);
-		glTexCoord2f(1, 1); glVertex2f(1, 1);
-		glTexCoord2f(0, 1); glVertex2f(0, 1);
-	glEnd();
-	glPopMatrix();
-
-	glReadBuffer(GL_BACK);
-
-	/* Take more than one sample, just to be sure */
-	for(sy = 0; sy < 4; ++sy) {
-		for(sx = 0; sx < 4; ++sx) {
-			int x = (cellx*5 + sx + 1)*piglit_width/20;
-			int y = (celly*5 + sy + 1)*piglit_height/10;
-
-			if (!piglit_probe_pixel_rgb(x, y, TextureColor)) {
-				fprintf(stderr, "Fail in cell %i,%i (texwrap = 0x%x)\n", cellx, celly, wrapt);
-
-				return GL_FALSE;
-			}
-		}
-	}
-
-	return GL_TRUE;
-}
-
-enum piglit_result
-piglit_display(void)
-{
-	GLboolean pass = GL_TRUE;
-
-	glClearColor(0.5, 0.5, 0.5, 1.0);
-	glClear(GL_COLOR_BUFFER_BIT);
-
-        /* Draw eight tiles, each with a different tex wrap mode.
-         * They should all look the same.
-         */
-	pass &= test(GL_REPEAT, 0, 0);
-	pass &= test(GL_CLAMP, 1, 0);
-	pass &= test(GL_CLAMP_TO_EDGE, 2, 0);
-	pass &= test(GL_CLAMP_TO_BORDER, 3, 0);
-	pass &= test(GL_MIRRORED_REPEAT, 0, 1);
-	if (piglit_is_extension_supported("GL_EXT_texture_mirror_clamp")) {
-		pass &= test(GL_MIRROR_CLAMP_EXT, 1, 1);
-		pass &= test(GL_MIRROR_CLAMP_TO_EDGE_EXT, 2, 1);
-		pass &= test(GL_MIRROR_CLAMP_TO_BORDER_EXT, 3, 1);
-	}
-
-	piglit_present_results();
-
-	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	(void) argc;
-	(void) argv;
-
-	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-	glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 1, 0, GL_RGB, GL_FLOAT, TextureColor);
-	glEnable(GL_TEXTURE_1D);
-
-	piglit_ortho_projection(1.0, 1.0, GL_FALSE);
-
-	if (!piglit_automatic)
-		printf("You should see a flat orange color\n");
-}
diff --git a/tests/spec/gl-1.4/CMakeLists.gl.txt b/tests/spec/gl-1.4/CMakeLists.gl.txt
index 22ce3c4..907c59e 100644
--- a/tests/spec/gl-1.4/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.4/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 piglit_add_executable (gl-1.4-dlist-multidrawarrays dlist-multidrawarrays.c)
 piglit_add_executable (gl-1.4-multidrawarrays-errors multidrawarrays-errors.c)
 piglit_add_executable (gl-1.4-polygon-offset polygon-offset.c)
+piglit_add_executable (gl-1.4-tex1d-2dborder tex1d-2dborder.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.4/tex1d-2dborder.c b/tests/spec/gl-1.4/tex1d-2dborder.c
new file mode 100644
index 0000000..2d0abf1
--- /dev/null
+++ b/tests/spec/gl-1.4/tex1d-2dborder.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright © 2008 Nicolai Hähnle
+ *
+ * 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
+ * VA LINUX SYSTEM, IBM 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 tex1d-2border.c
+ * Test whether 1D textures correctly ignore the T coordinate wrap mode.
+ *
+ * Since 1D textures are genuine one-dimensional objects, the T coordinate
+ * shouldn't affect them at all. However, R300 simulates them as flat
+ * 2D textures, which caused incorrect sampling of border colors.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 14;
+
+	config.window_width = 256;
+	config.window_height = 128;
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+	config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const GLfloat TextureColor[3] = { 1.0, 0.5, 0.0 };
+
+
+static GLboolean test(GLenum wrapt, int cellx, int celly)
+{
+	int sx, sy;
+
+	glPushMatrix();
+	glTranslatef(cellx*0.25, celly*0.5, 0.0);
+	glScalef(0.25, 0.5, 1.0);
+	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, wrapt);
+	glBegin(GL_QUADS);
+		glTexCoord2f(0, 0); glVertex2f(0, 0);
+		glTexCoord2f(1, 0); glVertex2f(1, 0);
+		glTexCoord2f(1, 1); glVertex2f(1, 1);
+		glTexCoord2f(0, 1); glVertex2f(0, 1);
+	glEnd();
+	glPopMatrix();
+
+	glReadBuffer(GL_BACK);
+
+	/* Take more than one sample, just to be sure */
+	for(sy = 0; sy < 4; ++sy) {
+		for(sx = 0; sx < 4; ++sx) {
+			int x = (cellx*5 + sx + 1)*piglit_width/20;
+			int y = (celly*5 + sy + 1)*piglit_height/10;
+
+			if (!piglit_probe_pixel_rgb(x, y, TextureColor)) {
+				fprintf(stderr, "Fail in cell %i,%i (texwrap = 0x%x)\n", cellx, celly, wrapt);
+
+				return GL_FALSE;
+			}
+		}
+	}
+
+	return GL_TRUE;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	GLboolean pass = GL_TRUE;
+
+	glClearColor(0.5, 0.5, 0.5, 1.0);
+	glClear(GL_COLOR_BUFFER_BIT);
+
+        /* Draw eight tiles, each with a different tex wrap mode.
+         * They should all look the same.
+         */
+	pass &= test(GL_REPEAT, 0, 0);
+	pass &= test(GL_CLAMP, 1, 0);
+	pass &= test(GL_CLAMP_TO_EDGE, 2, 0);
+	pass &= test(GL_CLAMP_TO_BORDER, 3, 0);
+	pass &= test(GL_MIRRORED_REPEAT, 0, 1);
+	if (piglit_is_extension_supported("GL_EXT_texture_mirror_clamp")) {
+		pass &= test(GL_MIRROR_CLAMP_EXT, 1, 1);
+		pass &= test(GL_MIRROR_CLAMP_TO_EDGE_EXT, 2, 1);
+		pass &= test(GL_MIRROR_CLAMP_TO_BORDER_EXT, 3, 1);
+	}
+
+	piglit_present_results();
+
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void piglit_init(int argc, char **argv)
+{
+	(void) argc;
+	(void) argv;
+
+	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+	glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 1, 0, GL_RGB, GL_FLOAT, TextureColor);
+	glEnable(GL_TEXTURE_1D);
+
+	piglit_ortho_projection(1.0, 1.0, GL_FALSE);
+
+	if (!piglit_automatic)
+		printf("You should see a flat orange color\n");
+}
-- 
2.7.4



More information about the Piglit mailing list