summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2011-08-19 08:43:56 -0700
committerIan Romanick <ian.d.romanick@intel.com>2011-08-24 16:14:12 -0700
commit42e894b588108e927db827f1bac869e62107a75b (patch)
treef4496d1a6995000db0e9e5904f1805d197402f4d
parent29bea467dbaa00be0deb792065b263aed379ab43 (diff)
gl-2.0: Add getattriblocation-conventional test
This test verifies that calling glGetAttribLocation on a "conventional" attribute will return -1.
-rw-r--r--tests/all.tests1
-rw-r--r--tests/spec/CMakeLists.txt1
-rw-r--r--tests/spec/gl-2.0/CMakeLists.txt1
-rw-r--r--tests/spec/gl-2.0/api/CMakeLists.gl.txt15
-rw-r--r--tests/spec/gl-2.0/api/CMakeLists.txt1
-rw-r--r--tests/spec/gl-2.0/api/getattriblocation-conventional.c61
6 files changed, 80 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests
index f91c34e21..c21740a2d 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -722,6 +722,7 @@ add_texwrap_test2(gl20, '2D', 'npot')
add_texwrap_test3(gl20, '2D', 'npot', 'proj')
add_texwrap_test2(gl20, '3D', 'npot')
add_texwrap_test3(gl20, '3D', 'npot', 'proj')
+add_plain_test(gl20, 'getattriblocation-conventional')
# Group spec/glsl-1.00
spec['glsl-1.00'] = Group()
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 94c53b8a0..a365a351d 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -22,4 +22,5 @@ add_subdirectory (arb_vertex_program)
add_subdirectory (arb_copy_buffer)
add_subdirectory (glsl-1.20)
add_subdirectory (glsl-1.30)
+add_subdirectory (gl-2.0)
add_subdirectory (arb_vertex_type_2_10_10_10_rev)
diff --git a/tests/spec/gl-2.0/CMakeLists.txt b/tests/spec/gl-2.0/CMakeLists.txt
new file mode 100644
index 000000000..9a1370285
--- /dev/null
+++ b/tests/spec/gl-2.0/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory (api)
diff --git a/tests/spec/gl-2.0/api/CMakeLists.gl.txt b/tests/spec/gl-2.0/api/CMakeLists.gl.txt
new file mode 100644
index 000000000..31481d628
--- /dev/null
+++ b/tests/spec/gl-2.0/api/CMakeLists.gl.txt
@@ -0,0 +1,15 @@
+include_directories(
+ ${OPENGL_INCLUDE_PATH}
+ ${GLUT_INCLUDE_DIR}
+ ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+ piglitutil
+ ${OPENGL_gl_LIBRARY}
+ ${GLUT_glut_LIBRARY}
+)
+
+add_executable (getattriblocation-conventional getattriblocation-conventional.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/gl-2.0/api/CMakeLists.txt b/tests/spec/gl-2.0/api/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/gl-2.0/api/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/gl-2.0/api/getattriblocation-conventional.c b/tests/spec/gl-2.0/api/getattriblocation-conventional.c
new file mode 100644
index 000000000..b4fd4b211
--- /dev/null
+++ b/tests/spec/gl-2.0/api/getattriblocation-conventional.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2011 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 getattriblocation-conventional.c
+ * Verify that glGetAttribLocation on a conventional attribute returns -1.
+ *
+ * \author Ian Romanick
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+static const char *vs_code =
+ "attribute vec4 not_used;\n"
+ "void main() { gl_Position = gl_Vertex; }"
+ ;
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void piglit_init(int argc, char **argv)
+{
+ GLint vert;
+ GLint prog;
+ GLint loc;
+
+ piglit_require_vertex_shader();
+ vert = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
+ prog = piglit_link_simple_program(vert, 0);
+
+ loc = piglit_GetAttribLocation(prog, "gl_Vertex");
+ printf("Attribute location reported for gl_Vertex is %d.\n", loc);
+
+ piglit_report_result(loc == -1 ? PIGLIT_PASS : PIGLIT_FAIL);
+}