[Piglit] [PATCH 1/2] arb_shader_stencil_export: move to standard location

Ben Widawsky benjamin.widawsky at intel.com
Thu Oct 22 22:00:46 PDT 2015


While here, just use the simple piglit helper functions to compile and link the
program. In particular, this makes the magic "129" easier to understand.

Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
---
 tests/shaders/CMakeLists.gl.txt                    |  1 -
 tests/shaders/glsl-fs-shader-stencil-export.c      | 88 ---------------------
 tests/shaders/glsl-fs-shader-stencil-export.frag   |  8 --
 tests/spec/CMakeLists.txt                          |  1 +
 .../arb_shader_stencil_export/CMakeLists.gl.txt    | 13 ++++
 .../spec/arb_shader_stencil_export/CMakeLists.txt  |  1 +
 .../glsl-fs-shader-stencil-export.c                | 90 ++++++++++++++++++++++
 7 files changed, 105 insertions(+), 97 deletions(-)
 delete mode 100644 tests/shaders/glsl-fs-shader-stencil-export.c
 delete mode 100644 tests/shaders/glsl-fs-shader-stencil-export.frag
 create mode 100644 tests/spec/arb_shader_stencil_export/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_shader_stencil_export/CMakeLists.txt
 create mode 100644 tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c

diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index abbe14c..32a6956 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -84,7 +84,6 @@ IF (NOT MSVC)
 	piglit_add_executable (glsl-fs-raytrace-bug27060 glsl-fs-raytrace-bug27060.c)
 ENDIF ()
 piglit_add_executable (glsl-fs-sampler-numbering glsl-fs-sampler-numbering.c)
-piglit_add_executable (glsl-fs-shader-stencil-export glsl-fs-shader-stencil-export.c)
 piglit_add_executable (glsl-fs-sqrt-branch glsl-fs-sqrt-branch.c)
 piglit_add_executable (glsl-fs-texturecube glsl-fs-texturecube.c)
 piglit_add_executable (glsl-fs-texturecube-2 glsl-fs-texturecube-2.c)
diff --git a/tests/shaders/glsl-fs-shader-stencil-export.c b/tests/shaders/glsl-fs-shader-stencil-export.c
deleted file mode 100644
index 1461798..0000000
--- a/tests/shaders/glsl-fs-shader-stencil-export.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright © 2010 Red Hat
- *
- * 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.
- *
- * Authors:
- * 	Dave Airlie <airlied at redhat.com>
- *
- */
-
-/** @file glsl-fs-shader-stencil-export.c
- *
- */
-
-#include "piglit-util-gl.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-
-	config.window_width = 256;
-	config.window_height = 256;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-static GLint prog;
-
-enum piglit_result
-piglit_display(void)
-{
-	GLboolean pass = GL_TRUE;
-	float p[4];
-
-	glClearColor(0.5, 0.5, 0.5, 0.5);
-	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
-	glEnable(GL_STENCIL_TEST);
-	glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
-
-	piglit_draw_rect(0, 0, piglit_width, piglit_height);
-
-	glReadPixels(0, 0, 3, 1, GL_STENCIL_INDEX, GL_FLOAT, p);
-	piglit_present_results();
-
-	/* we hardcode 129 in the shader */
-	if (p[0] != 129)
-		pass = GL_FALSE;
-	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
-	GLint vs, fs;
-
-	piglit_require_extension("GL_ARB_shader_stencil_export");
-	piglit_require_gl_version(20);
-
-
-	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-
-	vs = piglit_compile_shader(GL_VERTEX_SHADER,
-				   "shaders/glsl-mvp.vert");
-	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
-				   "shaders/glsl-fs-shader-stencil-export.frag");
-
-	prog = piglit_link_simple_program(vs, fs);
-
-	glUseProgram(prog);
-}
diff --git a/tests/shaders/glsl-fs-shader-stencil-export.frag b/tests/shaders/glsl-fs-shader-stencil-export.frag
deleted file mode 100644
index e4fd680..0000000
--- a/tests/shaders/glsl-fs-shader-stencil-export.frag
+++ /dev/null
@@ -1,8 +0,0 @@
-#version 120
-#extension GL_ARB_shader_stencil_export: enable
-
-void main()
-{
-	gl_FragDepth = 1.0;
-	gl_FragStencilRefARB = 129;
-}
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 5dc37a1..727728b 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -49,6 +49,7 @@ add_subdirectory (arb_shader_atomic_counters)
 add_subdirectory (arb_shader_objects)
 add_subdirectory (arb_shader_image_load_store)
 add_subdirectory (arb_shader_image_size)
+add_subdirectory (arb_shader_stencil_export)
 add_subdirectory (arb_shading_language_420pack/execution)
 add_subdirectory (arb_stencil_texturing)
 add_subdirectory (arb_sync)
diff --git a/tests/spec/arb_shader_stencil_export/CMakeLists.gl.txt b/tests/spec/arb_shader_stencil_export/CMakeLists.gl.txt
new file mode 100644
index 0000000..86d55a9
--- /dev/null
+++ b/tests/spec/arb_shader_stencil_export/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+	${GLEXT_INCLUDE_DIR}
+	${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+	piglitutil_${piglit_target_api}
+	${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (glsl-fs-shader-stencil-export glsl-fs-shader-stencil-export.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_shader_stencil_export/CMakeLists.txt b/tests/spec/arb_shader_stencil_export/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_shader_stencil_export/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c b/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c
new file mode 100644
index 0000000..e4db7ca
--- /dev/null
+++ b/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2010 Red Hat
+ *
+ * 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.
+ *
+ * Authors:
+ * 	Dave Airlie <airlied at redhat.com>
+ *
+ */
+
+/** @file glsl-fs-shader-stencil-export.c
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+
+	config.window_width = 256;
+	config.window_height = 256;
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLint prog;
+
+enum piglit_result
+piglit_display(void)
+{
+	GLboolean pass = GL_TRUE;
+	float p[4];
+
+	glClearColor(0.5, 0.5, 0.5, 0.5);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+
+	glEnable(GL_STENCIL_TEST);
+	glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+
+	piglit_draw_rect(-1, -1, 2, 2);
+
+	glReadPixels(0, 0, 3, 1, GL_STENCIL_INDEX, GL_FLOAT, p);
+	piglit_present_results();
+
+	/* we hardcode 129 in the shader */
+	if (p[0] != 129)
+		pass = GL_FALSE;
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_ARB_shader_stencil_export");
+	piglit_require_gl_version(20);
+
+
+	prog = piglit_build_simple_program(
+			"#version 120\n"
+			"void main() {\n"
+			"       gl_Position = gl_Vertex;\n"
+			"}\n",
+
+			"#version 120\n"
+			"#extension GL_ARB_shader_stencil_export : enable\n"
+			"void main() {\n"
+			"	gl_FragDepth = 1.0;\n"
+			"	gl_FragStencilRefARB = 129;\n"
+			"}\n");
+
+	glUseProgram(prog);
+}
-- 
2.6.1



More information about the Piglit mailing list