[Piglit] [PATCH] glsl: fix link empty program tests
Timothy Arceri
timothy.arceri at collabora.com
Mon Jan 25 03:43:51 PST 2016
Also move them out of the shaders folder.
>From Section 7.3 (PROGRAM OBJECTS) of the OpenGL 4.5 spec:
"Linking can fail for a variety of reasons as specified in the
OpenGL Shading Language Specification, as well as any of the
following reasons:
- No shader objects are attached to program."
---
tests/shaders/CMakeLists.gl.txt | 2 -
tests/shaders/glsl-link-empty-prog-01.c | 53 -------------
tests/shaders/glsl-link-empty-prog-02.c | 115 ----------------------------
tests/spec/gl-2.0/CMakeLists.gl.txt | 2 +
tests/spec/gl-2.0/glsl-link-empty-prog-01.c | 53 +++++++++++++
tests/spec/gl-2.0/glsl-link-empty-prog-02.c | 115 ++++++++++++++++++++++++++++
6 files changed, 170 insertions(+), 170 deletions(-)
delete mode 100644 tests/shaders/glsl-link-empty-prog-01.c
delete mode 100644 tests/shaders/glsl-link-empty-prog-02.c
create mode 100644 tests/spec/gl-2.0/glsl-link-empty-prog-01.c
create mode 100644 tests/spec/gl-2.0/glsl-link-empty-prog-02.c
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index abbe14c..42c6fae 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -111,8 +111,6 @@ piglit_add_executable (glsl-vs-user-varying-ff glsl-vs-user-varying-ff.c)
piglit_add_executable (glsl-light-model glsl-light-model.c)
piglit_add_executable (glsl-link-bug30552 glsl-link-bug30552.c)
piglit_add_executable (glsl-link-bug38015 glsl-link-bug38015.c)
-piglit_add_executable (glsl-link-empty-prog-01 glsl-link-empty-prog-01.c)
-piglit_add_executable (glsl-link-empty-prog-02 glsl-link-empty-prog-02.c)
piglit_add_executable (glsl-link-initializer-03 glsl-link-initializer-03.c)
piglit_add_executable (glsl-link-test glsl-link-test.c)
piglit_add_executable (gpu_shader4_attribs gpu_shader4_attribs.c)
diff --git a/tests/shaders/glsl-link-empty-prog-01.c b/tests/shaders/glsl-link-empty-prog-01.c
deleted file mode 100644
index 88c24d7..0000000
--- a/tests/shaders/glsl-link-empty-prog-01.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2010 Török Edwin
- *
- * 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.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
- config.supports_gl_compat_version = 10;
-
- config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-enum piglit_result piglit_display(void)
-{
- GLint objID = glCreateProgram();
- /* check that it doesn't crash when linking empty shader */
- glLinkProgram(objID);
- glValidateProgram(objID);
- if (!piglit_link_check_status(objID))
- piglit_report_result(PIGLIT_FAIL);
- glUseProgram(objID);
- glUseProgram(0);
- glDeleteProgram(objID);
- piglit_report_result(PIGLIT_PASS);
- return PIGLIT_PASS;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
- piglit_require_gl_version(20);
-}
diff --git a/tests/shaders/glsl-link-empty-prog-02.c b/tests/shaders/glsl-link-empty-prog-02.c
deleted file mode 100644
index c684047..0000000
--- a/tests/shaders/glsl-link-empty-prog-02.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/** @file glsl-link-empty-prog-02.c
- *
- * Verify behavior when a program object with no shaders attached is used.
- * Neither the OpenGL spec nor the GLSL spec are explicit about what happens
- * in this case. However, the correct behavior can be infered from a few bits
- * in the spec. Section 2.15 of the GL 2.1 spec says:
- *
- * "When the program object currently in use includes a vertex shader, its
- * vertex shader is considered active and is used to process vertices. If
- * the program object has no vertex shader, or no program object is
- * currently in use, the fixed-function method for processing vertices is
- * used instead."
- *
- * Section 3.11 of the OpenGL 2.1 spec says:
- *
- * "When the program object currently in use includes a fragment shader,
- * its fragment shader is considered active, and is used to process
- * fragments. If the program object has no fragment shader, or no program
- * object is currently in use, the fixed-function fragment processing
- * operations described in previous sections are used."
- *
- * If there is no vertex shader in the program, fixed-function vertex state is
- * used. If there is no fragment shader in the program, fixed-function
- * fragment state is used. If there is no vertex shader and no fragment
- * shader in the program, fixed-function vertex and fragment state are used.
- *
- * This test configures some simple fixed-function vertex and fragment state.
- * It verifies that this state is used when an "empty" program is active.
- *
- * \author Ian Romanick <ian.d.romanick at intel.com>
- */
-
-#include "piglit-util-gl.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
- config.supports_gl_compat_version = 10;
-
- config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-static GLuint prog = 0;
-static GLuint tex = 0;
-
-static const float black[4] = { 0.0, 0.0, 0.0, 1.0 };
-static const float white[4] = { 1.0, 1.0, 1.0, 1.0 };
-static const float green[4] = { 0.0, 1.0, 0.0, 1.0 };
-
-enum piglit_result
-piglit_display(void)
-{
- GLboolean pass = GL_TRUE;
-
- glColor4fv(green);
- piglit_draw_rect_tex(0.0, 0.0,
- (float) piglit_width, (float) piglit_height,
- 0.0, 0.0, 1.0, 1.0);
-
- pass &= piglit_probe_pixel_rgb(0, 0, black);
- pass &= piglit_probe_pixel_rgb(piglit_width - 1, 0, green);
- pass &= piglit_probe_pixel_rgb(0, piglit_height - 1, green);
- pass &= piglit_probe_pixel_rgb(piglit_width - 1, piglit_height - 1,
- black);
-
- piglit_present_results();
-
- return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
- piglit_require_gl_version(20);
-
- prog = glCreateProgram();
-
- glLinkProgram(prog);
- if (!piglit_link_check_status(prog))
- piglit_report_result(PIGLIT_FAIL);
-
- glUseProgram(prog);
-
- glGenTextures(1, &tex);
- glBindTexture(GL_TEXTURE_2D, tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glEnable(GL_TEXTURE_2D);
- piglit_checkerboard_texture(tex, 0, 16, 16, 2, 2, black, white);
-
- piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt b/tests/spec/gl-2.0/CMakeLists.gl.txt
index 20b315a..f847df4 100644
--- a/tests/spec/gl-2.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-2.0/CMakeLists.gl.txt
@@ -13,6 +13,8 @@ piglit_add_executable (vertex-program-two-side vertex-program-two-side.c)
piglit_add_executable (gl-2.0-edgeflag edgeflag.c)
piglit_add_executable (gl-2.0-edgeflag-immediate edgeflag-immediate.c)
piglit_add_executable (gl-2.0-large-point-fs large-point-fs.c)
+piglit_add_executable (gl-2.0-link-empty-prog-01 glsl-link-empty-prog-01.c)
+piglit_add_executable (gl-2.0-link-empty-prog-02 glsl-link-empty-prog-02.c)
piglit_add_executable (gl-2.0-two-sided-stencil two-sided-stencil.c)
piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c)
piglit_add_executable (gl-2.0-vertex-const-attr vertex-const-attr.c)
diff --git a/tests/spec/gl-2.0/glsl-link-empty-prog-01.c b/tests/spec/gl-2.0/glsl-link-empty-prog-01.c
new file mode 100644
index 0000000..ec3c688
--- /dev/null
+++ b/tests/spec/gl-2.0/glsl-link-empty-prog-01.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2010 Török Edwin
+ *
+ * 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.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result piglit_display(void)
+{
+ GLint objID = glCreateProgram();
+ /* check that it doesn't crash when linking empty shader */
+ glLinkProgram(objID);
+ if (piglit_link_check_status(objID))
+ piglit_report_result(PIGLIT_FAIL);
+ glValidateProgram(objID);
+ glUseProgram(objID);
+ glUseProgram(0);
+ glDeleteProgram(objID);
+ piglit_report_result(PIGLIT_PASS);
+ return PIGLIT_PASS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_gl_version(20);
+}
diff --git a/tests/spec/gl-2.0/glsl-link-empty-prog-02.c b/tests/spec/gl-2.0/glsl-link-empty-prog-02.c
new file mode 100644
index 0000000..62c46fb
--- /dev/null
+++ b/tests/spec/gl-2.0/glsl-link-empty-prog-02.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2010 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.
+ */
+
+/** @file glsl-link-empty-prog-02.c
+ *
+ * Verify behavior when a program object with no shaders attached is used.
+ * Neither the OpenGL spec nor the GLSL spec are explicit about what happens
+ * in this case. However, the correct behavior can be infered from a few bits
+ * in the spec. Section 2.15 of the GL 2.1 spec says:
+ *
+ * "When the program object currently in use includes a vertex shader, its
+ * vertex shader is considered active and is used to process vertices. If
+ * the program object has no vertex shader, or no program object is
+ * currently in use, the fixed-function method for processing vertices is
+ * used instead."
+ *
+ * Section 3.11 of the OpenGL 2.1 spec says:
+ *
+ * "When the program object currently in use includes a fragment shader,
+ * its fragment shader is considered active, and is used to process
+ * fragments. If the program object has no fragment shader, or no program
+ * object is currently in use, the fixed-function fragment processing
+ * operations described in previous sections are used."
+ *
+ * If there is no vertex shader in the program, fixed-function vertex state is
+ * used. If there is no fragment shader in the program, fixed-function
+ * fragment state is used. If there is no vertex shader and no fragment
+ * shader in the program, fixed-function vertex and fragment state are used.
+ *
+ * This test configures some simple fixed-function vertex and fragment state.
+ * It verifies that this state is used when an "empty" program is active.
+ *
+ * \author Ian Romanick <ian.d.romanick at intel.com>
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint prog = 0;
+static GLuint tex = 0;
+
+static const float black[4] = { 0.0, 0.0, 0.0, 1.0 };
+static const float white[4] = { 1.0, 1.0, 1.0, 1.0 };
+static const float green[4] = { 0.0, 1.0, 0.0, 1.0 };
+
+enum piglit_result
+piglit_display(void)
+{
+ GLboolean pass = GL_TRUE;
+
+ glColor4fv(green);
+ piglit_draw_rect_tex(0.0, 0.0,
+ (float) piglit_width, (float) piglit_height,
+ 0.0, 0.0, 1.0, 1.0);
+
+ pass &= piglit_probe_pixel_rgb(0, 0, black);
+ pass &= piglit_probe_pixel_rgb(piglit_width - 1, 0, green);
+ pass &= piglit_probe_pixel_rgb(0, piglit_height - 1, green);
+ pass &= piglit_probe_pixel_rgb(piglit_width - 1, piglit_height - 1,
+ black);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_gl_version(20);
+
+ prog = glCreateProgram();
+
+ glLinkProgram(prog);
+ if (piglit_link_check_status(prog))
+ piglit_report_result(PIGLIT_FAIL);
+
+ glUseProgram(prog);
+
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glEnable(GL_TEXTURE_2D);
+ piglit_checkerboard_texture(tex, 0, 16, 16, 2, 2, black, white);
+
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+}
--
2.4.3
More information about the Piglit
mailing list