diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-11-16 08:33:26 -0800 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-11-01 17:00:10 -0700 |
commit | d7a22200716b27d68556060e563dd33938d9c04f (patch) | |
tree | 337f7d2ad051ab59bdd2c0e16e2d354812d1782c | |
parent | 641d4e2450ea374dd3db1622903d5e64122a972c (diff) |
Add an even simpler version of primgen:
No clears (since those require the pixel pipeline to work)
No ortho
No colors
No drawing
Rasterizer Discard
-rw-r--r-- | tests/spec/ext_transform_feedback/CMakeLists.gl.txt | 2 | ||||
-rw-r--r-- | tests/spec/ext_transform_feedback/pipeline-basic-primgen.c | 89 |
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt index 1d03abd94..641255411 100644 --- a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt +++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt @@ -30,6 +30,8 @@ piglit_add_executable (ext_transform_feedback-intervening-read intervening-read. piglit_add_executable (ext_transform_feedback-max-varyings max-varyings.c) piglit_add_executable (ext_transform_feedback-negative-prims negative-prims.c) piglit_add_executable (ext_transform_feedback-nonflat-integral nonflat-integral.c) +piglit_add_executable (ext_transform_feedback-pipeline-basic-primgen +pipeline-basic-primgen.c) piglit_add_executable (ext_transform_feedback-primgen primgen.c) piglit_add_executable (ext_transform_feedback-separate separate.c) piglit_add_executable (ext_transform_feedback-output-type output-type.c) diff --git a/tests/spec/ext_transform_feedback/pipeline-basic-primgen.c b/tests/spec/ext_transform_feedback/pipeline-basic-primgen.c new file mode 100644 index 000000000..4db1636e9 --- /dev/null +++ b/tests/spec/ext_transform_feedback/pipeline-basic-primgen.c @@ -0,0 +1,89 @@ +/* + * Copyright © 2013 Marek Olšák <maraeo@gmail.com> + * + * 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. + */ + +/** + * Tests if PRIMITIVES_GENERATED works with transform feedback disabled. + * + * From EXT_transform_feedback: + * "the primitives-generated count is incremented every time a primitive + * reaches the Discarding Rasterization stage" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = "void main() { gl_Position = gl_Vertex; }"; + +GLuint prog; +GLuint q; + +void piglit_init(int argc, char **argv) +{ + unsigned qresult; + int expected = 2; + GLuint vs; + + /* Check the driver. */ + piglit_require_gl_version(15); + piglit_require_GLSL(); + piglit_require_transform_feedback(); + + glGenQueries(1, &q); + + glEnable(GL_RASTERIZER_DISCARD); + + /* Create shaders. */ + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); + prog = glCreateProgram(); + glAttachShader(prog, vs); + glLinkProgram(prog); + if (!piglit_link_check_status(prog)) { + glDeleteProgram(prog); + piglit_report_result(PIGLIT_FAIL); + } + glUseProgram(prog); + + glBeginQuery(GL_PRIMITIVES_GENERATED, q); + piglit_draw_rect(-1, -1, 2, 2); + glEndQuery(GL_PRIMITIVES_GENERATED); + glGetQueryObjectuiv(q, GL_QUERY_RESULT, &qresult); + + if (qresult != expected) { + printf("Primitives generated: %i, Expected: %i\n", + qresult, expected); + piglit_report_result(PIGLIT_FAIL); + } + + piglit_report_result(PIGLIT_PASS); +} + +enum piglit_result piglit_display(void) +{ + return PIGLIT_FAIL; /* should not get here */ +} |