summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@dodonov.net>2011-08-22 17:16:33 -0300
committerEugeni Dodonov <eugeni@dodonov.net>2011-08-23 12:44:03 -0300
commit7c2fee2b649ba6a39e6fa18ddf60eaca0706da4b (patch)
tree33cea5cd65467aa48f4ed8ad00816f7641b5bcd2
parent3f04023393902b2d29a9e91f9e2f38caa53d520e (diff)
Added initial piglit test for EXT_transform_feedback.
This test initially provides API test for EXT_transform_feedback, checking for new functions, tokens, and the support for new tokens in existent GL entry points..
-rw-r--r--tests/spec/CMakeLists.txt1
-rw-r--r--tests/spec/ext_transform_feedback/CMakeLists.gl.txt17
-rw-r--r--tests/spec/ext_transform_feedback/CMakeLists.txt1
-rw-r--r--tests/spec/ext_transform_feedback/ext_transform_feedback-api.c318
4 files changed, 337 insertions, 0 deletions
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index b4e77070..4fd52917 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -12,6 +12,7 @@ add_subdirectory (arb_texture_float)
add_subdirectory (ati_envmap_bumpmap)
add_subdirectory (ext_fog_coord)
add_subdirectory (ext_packed_depth_stencil)
+add_subdirectory (ext_transform_feedback)
add_subdirectory (nv_conditional_render)
add_subdirectory (nv_texture_barrier)
add_subdirectory (arb_draw_elements_base_vertex)
diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
new file mode 100644
index 00000000..55b0a79a
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
@@ -0,0 +1,17 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+ ${GLUT_INCLUDE_DIR}
+ ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+ piglitutil
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+ ${GLUT_glut_LIBRARY}
+)
+
+add_executable (ext_transform_feedback-api ext_transform_feedback-api.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_transform_feedback/CMakeLists.txt b/tests/spec/ext_transform_feedback/CMakeLists.txt
new file mode 100644
index 00000000..144a306f
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/ext_transform_feedback/ext_transform_feedback-api.c b/tests/spec/ext_transform_feedback/ext_transform_feedback-api.c
new file mode 100644
index 00000000..dcd44526
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/ext_transform_feedback-api.c
@@ -0,0 +1,318 @@
+/*
+ * 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 api.c
+ *
+ * Tests API support for EXT_Transform_feedback
+ */
+
+#include "piglit-util.h"
+
+#define GL_GLEXT_PROTOTYPES
+#include "glew.h"
+
+#define BUF_WIDTH 15
+#define BUF_HEIGHT 15
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+int piglit_width = BUF_WIDTH;
+int piglit_height = BUF_WIDTH;
+
+/**
+ * New <target> parameter for BindBuffer, BufferData,
+ * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData,
+ * GetBufferPointerv, BindBufferRangeEXT, BindBufferOffsetEXT and
+ * BindBufferBaseEXT:
+ *
+ * TRANSFORM_FEEDBACK_BUFFER_EXT
+ */
+
+static bool
+test_new_tokens_feedback_buffer_ext()
+{
+ bool pass = true;
+ GLuint buffer;
+ void *data;
+ GLenum valid_target = GL_TRANSFORM_FEEDBACK_BUFFER_EXT;
+ GLenum error;
+
+ glGenBuffers(1, &buffer);
+ /* BindBuffer test */
+ glBindBuffer(valid_target, buffer);
+ error = glGetError();
+ if (error == GL_INVALID_ENUM) {
+ pass = false;
+ }
+
+ /* MapBuffer */
+ data = glMapBuffer(buffer, GL_READ_WRITE);
+ /* TODO: check if data is set correctly - perhaps for operational test */
+ error = glGetError();
+ if (error == GL_INVALID_ENUM) {
+ pass = false;
+ }
+
+ /* UnmapBuffer */
+ glUnmapBuffer(buffer);
+ error = glGetError();
+ if (error == GL_INVALID_ENUM) {
+ pass = false;
+ }
+
+ glDeleteBuffers(1, &buffer);
+
+ return pass;
+}
+
+/**
+ * New <param> parameter for:
+ * GetIntegerIndexedvEXT and GetBooleanIndexedvEX:
+ *
+ * TRANSFORM_FEEDBACK_BUFFER_START_EXT
+ * TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT
+ *
+ */
+
+static bool
+test_new_tokens_feedback_buffer_start_size()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ *
+ * New <param> parameter for:
+ * GetIntegerIndexedvEXT and GetBooleanIndexedvEXT:
+ * Also, new <pname> parameter for:
+ * GetBooleanv, GetDoublev, GetIntegerv, and GetFloatv:
+ *
+ * TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT
+ *
+ */
+
+static bool
+test_new_tokens_feedback_buffer_binding()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ * New <bufferMode> parameters for TransformFeedbackVaryingsEXT:
+ *
+ * INTERLEAVED_ATTRIBS_EXT
+ * SEPARATE_ATTRIBS_EXT
+ *
+ *
+ */
+
+static bool
+test_new_tokens_feedback_attribs()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ * New <cap> parameter for Enable, Disable, and IsEnabled:
+ *
+ * And new <pname> parameter for GetBooleanv, GetIntegerv, GetFloatv,
+ * and GetDoublev:
+ * RASTERIZER_DISCARD_EXT
+ *
+ *
+ */
+
+static bool
+test_new_tokens_feedback_rasterized()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ * New <pname> parameter for GetBooleanv, GetDoublev, GetIntegerv,
+ * and GetFloatv:
+ *
+ * MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
+ * MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT
+ * MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT
+ *
+ *
+ */
+
+static bool
+test_new_tokens_feedback_interleaved_separate()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ * New <pname> parameter for GetProgramiv:
+ *
+ * TRANSFORM_FEEDBACK_VARYINGS_EXT
+ * TRANSFORM_FEEDBACK_BUFFER_MODE_EXT
+ * TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT
+ */
+static bool
+test_new_tokens_feedback_getprogramiv()
+{
+ bool pass = true;
+ return pass;
+}
+
+/**
+ * New <target> parameters for glBeginQuery / glEndQuery:
+ *
+ * PRIMITIVES_GENERATED_EXT
+ * TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT
+ */
+static bool
+test_begin_end_query()
+{
+ bool pass = true;
+ const GLenum valid_targets[] = {
+ GL_PRIMITIVES_GENERATED_EXT,
+ GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT,
+ };
+
+ const GLenum invalid_targets[] = {
+ 0,
+ -1,
+ GL_SEPARATE_ATTRIBS_EXT,
+ };
+ GLuint query;
+ int i;
+ GLenum error;
+
+ /* Generate query object */
+ glGenQueries(1, &query);
+
+ /**
+ * Test for BeginQuery/EndQuery targets with valid id
+ */
+ for (i=0; i < sizeof(valid_targets) / sizeof(valid_targets[0]); i++) {
+ glBeginQuery(valid_targets[i], query);
+ error = glGetError();
+ if (error == GL_INVALID_OPERATION) {
+ pass = false;
+ }
+ glEndQuery(valid_targets[i]);
+ }
+
+ /**
+ * Test for BeginQuery/EndQuery targets with id of 0
+ * this test is expected to fail when:
+ * - there is any active query object out there
+ * - its id is not 0
+ */
+ for (i=0; i < sizeof(valid_targets) / sizeof(valid_targets[0]); i++) {
+ /* 1st case */
+ /* TODO: verify if query is not 0 */
+ glBeginQuery(valid_targets[i], query);
+ glBeginQuery(valid_targets[i], 0);
+ error = glGetError();
+ if (error != GL_INVALID_OPERATION) {
+ pass = false;
+ }
+ glEndQuery(valid_targets[i]);
+
+ /* 2nd case */
+ glBeginQuery(valid_targets[i], 0);
+ error = glGetError();
+ if (error != GL_INVALID_OPERATION) {
+ pass = false;
+ }
+ glEndQuery(valid_targets[i]);
+ }
+
+ /**
+ * Test for BeginQuery/EndQuery with invalid targets
+ * this test is expected to fail
+ */
+ for (i=0; i < sizeof(invalid_targets) / sizeof(invalid_targets[0]); i++) {
+ glBeginQuery(invalid_targets[i], query);
+ error = glGetError();
+ if (error != GL_INVALID_OPERATION) {
+ pass = false;
+ }
+ glEndQuery(invalid_targets[i]);
+ }
+
+ glDeleteQueries(1, &query);
+
+ return pass;
+}
+
+static bool
+test()
+{
+ bool pass, result=true;
+
+ pass = test_new_tokens_feedback_buffer_ext();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_buffer_start_size();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_buffer_binding();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_attribs();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_rasterized();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_interleaved_separate();
+ if (pass != true)
+ result = false;
+ pass = test_new_tokens_feedback_getprogramiv();
+ if (pass != true)
+ result = false;
+ pass = test_begin_end_query();
+ if (pass != true)
+ result = false;
+
+ return result;
+}
+
+void piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+
+ glewInit();
+ piglit_require_extension("GL_EXT_transform_feedback");
+
+ pass = test();
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}