[Piglit] [PATCH] gl-3.1: Verify error for drawing with default VAO

Ian Romanick idr at freedesktop.org
Wed Feb 18 17:41:27 PST 2015


From: Ian Romanick <ian.d.romanick at intel.com>

This was the test case that I wrote for Mesa commit b93dcb0.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
This has been sitting in my piglit tree since early November 2014.  I
thought I already sent it to the list, but patchwork disagrees.

 tests/all.py                        |  1 +
 tests/spec/gl-3.1/CMakeLists.gl.txt |  1 +
 tests/spec/gl-3.1/default-vao.c     | 56 +++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 tests/spec/gl-3.1/default-vao.c

diff --git a/tests/all.py b/tests/all.py
index 35b353e..7917fd9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1009,6 +1009,7 @@ add_plain_test(gl30, ['sampler-cube-shadow'])
 
 gl31 = {}
 spec['!OpenGL 3.1'] = gl31
+gl31['default-vao'] = PiglitGLTest(['gl-3.1-default-vao'], run_concurrent=True)
 gl31['draw-buffers-errors'] = PiglitGLTest(['gl-3.1-draw-buffers-errors'], run_concurrent=True)
 gl31['genned-names'] = PiglitGLTest(['gl-3.1-genned-names'], run_concurrent=True)
 gl31['minmax'] = PiglitGLTest(['gl-3.1-minmax'], run_concurrent=True)
diff --git a/tests/spec/gl-3.1/CMakeLists.gl.txt b/tests/spec/gl-3.1/CMakeLists.gl.txt
index 2a7882d..a5f28c1 100644
--- a/tests/spec/gl-3.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.1/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
 	${OPENGL_glu_LIBRARY}
 )
 
+piglit_add_executable (gl-3.1-default-vao default-vao.c)
 piglit_add_executable (gl-3.1-draw-buffers-errors draw-buffers-errors.c)
 piglit_add_executable (gl-3.1-genned-names genned-names.c)
 piglit_add_executable (gl-3.1-minmax minmax.c)
diff --git a/tests/spec/gl-3.1/default-vao.c b/tests/spec/gl-3.1/default-vao.c
new file mode 100644
index 0000000..95c7322
--- /dev/null
+++ b/tests/spec/gl-3.1/default-vao.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 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
+ * 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 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 default-vao.c
+ * Verify that GL_INVALID_OPERATION is generated when the default VAO is used
+ * for rendering.
+ */
+
+#include "piglit-util-gl.h"
+#include "piglit-matrix.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+	config.supports_gl_core_version = 31;
+	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint prog = piglit_build_simple_program(
+			"#version 130\n void main() { gl_Position = vec4(0); }",
+			"#version 130\n void main() { gl_FragColor = vec4(0); }");
+	glUseProgram(prog);
+
+	glDrawArrays(GL_TRIANGLES, 0, 3);
+	piglit_report_result(piglit_check_gl_error(GL_INVALID_OPERATION)
+			     ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	/* unreached */
+	return PIGLIT_FAIL;
+}
-- 
2.1.0



More information about the Piglit mailing list