[Piglit] [PATCH] gles2: add test to render a point without vertex attributes
Tapani Pälli
tapani.palli at intel.com
Wed Oct 1 00:22:44 PDT 2014
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
tests/spec/gles-2.0/CMakeLists.gles2.txt | 1 +
tests/spec/gles-2.0/glsl-no-vertex-attribs.c | 75 ++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
create mode 100644 tests/spec/gles-2.0/glsl-no-vertex-attribs.c
diff --git a/tests/spec/gles-2.0/CMakeLists.gles2.txt b/tests/spec/gles-2.0/CMakeLists.gles2.txt
index e2e5433..f1f8d14 100644
--- a/tests/spec/gles-2.0/CMakeLists.gles2.txt
+++ b/tests/spec/gles-2.0/CMakeLists.gles2.txt
@@ -8,5 +8,6 @@ piglit_add_executable(link-no-vsfs_gles2 link-no-vsfs.c)
piglit_add_executable(minmax_gles2 minmax.c)
piglit_add_executable(multiple-shader-objects_gles2 multiple-shader-objects.c)
piglit_add_executable(fbo_discard_gles2 fbo-discard.c)
+piglit_add_executable(glsl-no-vertex-attribs_gles2 glsl-no-vertex-attribs.c)
# vim: ft=cmake:
diff --git a/tests/spec/gles-2.0/glsl-no-vertex-attribs.c b/tests/spec/gles-2.0/glsl-no-vertex-attribs.c
new file mode 100644
index 0000000..fcb2030
--- /dev/null
+++ b/tests/spec/gles-2.0/glsl-no-vertex-attribs.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2014 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-no-vertexattribs.c
+ *
+ * Tests that we can succesfully render a point with OpenGL ES 2.0
+ * without having any vertex attributes enabled.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.window_width = 1;
+ config.window_height = 1;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLint prog;
+
+const char *vs_source =
+ "void main()\n"
+ "{\n"
+ " gl_PointSize = 1.0;\n"
+ " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
+ "}\n";
+
+const char *fs_source =
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
+ "}\n";
+
+enum piglit_result
+piglit_display(void)
+{
+ GLboolean pass = GL_TRUE;
+ const float green[4] = {0, 1, 0, 1};
+
+ glDrawArrays(GL_POINTS, 0, 1);
+
+ pass = pass && piglit_probe_pixel_rgba(0, 0, green);
+
+ glDeleteProgram(prog);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+void piglit_init(int argc, char**argv)
+{
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+}
+
--
1.9.3
More information about the Piglit
mailing list