[Piglit] [PATCH 2/2] gl-3.1: attributeless-vertexid; C => shader_test

Jordan Justen jordan.l.justen at intel.com
Wed May 14 11:01:56 PDT 2014


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Cc: Chris Forbes <chrisf at ijw.co.nz>
---
This also depends on
"shader_runner: enable VAO for gl >= 31 before glDrawArrays"

Also, does this actually require a core profile?

 tests/all.py                                       |  1 -
 tests/spec/gl-3.1/CMakeLists.gl.txt                |  1 -
 tests/spec/gl-3.1/attributeless-vertexid.c         | 85 ----------------------
 .../spec/gl-3.1/attributeless-vertexid.shader_test | 31 ++++++++
 4 files changed, 31 insertions(+), 87 deletions(-)
 delete mode 100644 tests/spec/gl-3.1/attributeless-vertexid.c
 create mode 100644 tests/spec/gl-3.1/attributeless-vertexid.shader_test

diff --git a/tests/all.py b/tests/all.py
index a67e725..70ad881 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1078,7 +1078,6 @@ for subtest in ['generated', 'written', 'flush']:
 gl31['required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 31')
 gl31['required-sized-texture-formats'] = concurrent_test('gl-3.0-required-sized-texture-formats 31')
 gl31['required-texture-attachment-formats'] = concurrent_test('gl-3.0-required-texture-attachment-formats 31')
-gl31['attributeless-vertexid'] = concurrent_test('gl-3.1-attributeless-vertexid')
 
 gl32 = {}
 spec['!OpenGL 3.2'] = gl32
diff --git a/tests/spec/gl-3.1/CMakeLists.gl.txt b/tests/spec/gl-3.1/CMakeLists.gl.txt
index cb60eb9..7d835e8 100644
--- a/tests/spec/gl-3.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.1/CMakeLists.gl.txt
@@ -13,6 +13,5 @@ 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)
 piglit_add_executable (gl-3.1-primitive-restart-xfb primitive-restart-xfb.c)
-piglit_add_executable (gl-3.1-attributeless-vertexid attributeless-vertexid.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-3.1/attributeless-vertexid.c b/tests/spec/gl-3.1/attributeless-vertexid.c
deleted file mode 100644
index 012c460..0000000
--- a/tests/spec/gl-3.1/attributeless-vertexid.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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 attributeless-vertexid.c
- *
- * Test that rendering with no vertex attributes (but only using gl_VertexID)
- * works in the core profile.
- */
-
-#include "piglit-util-gl-common.h"
-#include "minmax-test.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_core_version = 31;
-	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-const float red[] = { 1, 0, 0, 1 };
-
-enum piglit_result
-piglit_display(void)
-{
-	bool pass;
-
-	glViewport(0, 0, piglit_width, piglit_height);
-	glClearColor(0.2, 0.2, 0.2, 0.2);
-	glClear(GL_COLOR_BUFFER_BIT);
-
-	glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
-	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, red);
-
-	piglit_present_results();
-
-	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
-	GLuint prog = piglit_build_simple_program(
-		"#version 140\n"
-		"const vec2 verts[4] = vec2[](\n"
-		"	vec2(-1, 1),\n"
-		"	vec2(-1,-1),\n"
-		"	vec2( 1,-1),\n"
-		"	vec2( 1, 1)\n"
-		");\n"
-		"void main() {\n"
-		"	gl_Position = vec4(verts[gl_VertexID], 0, 1);\n"
-		"}\n",
-
-		"#version 140\n"
-		"void main() {\n"
-		"	gl_FragColor = vec4(1,0,0,1);\n"
-		"}\n");
-
-	GLuint vao;
-
-	glUseProgram(prog);
-
-	glGenVertexArrays(1, &vao);
-	glBindVertexArray(vao);
-}
diff --git a/tests/spec/gl-3.1/attributeless-vertexid.shader_test b/tests/spec/gl-3.1/attributeless-vertexid.shader_test
new file mode 100644
index 0000000..35bdc00
--- /dev/null
+++ b/tests/spec/gl-3.1/attributeless-vertexid.shader_test
@@ -0,0 +1,31 @@
+# Test that rendering with no vertex attributes (but only using gl_VertexID)
+# works in the core profile.
+
+[require]
+GL CORE >= 3.1
+GLSL >= 1.40
+
+[vertex shader]
+
+const vec2 verts[4] = vec2[](
+	vec2(-1, 1),
+	vec2(-1,-1),
+	vec2( 1,-1),
+	vec2( 1, 1)
+	);
+
+void main() {
+	gl_Position = vec4(verts[gl_VertexID], 0, 1);
+}
+
+[fragment shader]
+
+void main() {
+	gl_FragColor = vec4(1,0,0,1);
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 1.0 0.0 0.0 1.0
-- 
2.0.0.rc2



More information about the Piglit mailing list