[Piglit] [PATCH 1/3] ext_transform_feedback: test immediate index buffer reuse
Chris Forbes
chrisf at ijw.co.nz
Thu Jan 1 14:13:56 PST 2015
These three all pass on i965 with master, so I guess you have some
breakage at the gallium layer or below.
All three are:
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
On Fri, Jan 2, 2015 at 3:17 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> tests/all.py | 1 +
> .../spec/ext_transform_feedback/CMakeLists.gl.txt | 1 +
> .../immediate-reuse-index-buffer.c | 141 +++++++++++++++++++++
> 3 files changed, 143 insertions(+)
> create mode 100644 tests/spec/ext_transform_feedback/immediate-reuse-index-buffer.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 5faf69f..072cd23 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3128,6 +3128,7 @@ for mode in ['main_binding', 'indexed_binding', 'buffer_start', 'buffer_size']:
> ext_transform_feedback[test_name] = PiglitGLTest(
> 'ext_transform_feedback-{0}'.format(test_name), run_concurrent=True)
> ext_transform_feedback['immediate-reuse'] = PiglitGLTest('ext_transform_feedback-immediate-reuse', run_concurrent=True)
> +ext_transform_feedback['immediate-reuse-index-buffer'] = PiglitGLTest('ext_transform_feedback-immediate-reuse-index-buffer', run_concurrent=True)
> for mode in ['output', 'prims_generated', 'prims_written']:
> for use_gs in ['', ' use_gs']:
> test_name = 'intervening-read {0}{1}'.format(mode, use_gs)
> diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
> index 3019e55..b9ea32a 100644
> --- a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
> +++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
> @@ -26,6 +26,7 @@ piglit_add_executable (ext_transform_feedback-get-buffer-state get-buffer-state.
> piglit_add_executable (ext_transform_feedback-position position.c)
> piglit_add_executable (ext_transform_feedback-points points.c)
> piglit_add_executable (ext_transform_feedback-immediate-reuse immediate-reuse.c)
> +piglit_add_executable (ext_transform_feedback-immediate-reuse-index-buffer immediate-reuse-index-buffer.c)
> piglit_add_executable (ext_transform_feedback-interleaved interleaved.c)
> piglit_add_executable (ext_transform_feedback-intervening-read intervening-read.c)
> piglit_add_executable (ext_transform_feedback-max-varyings max-varyings.c)
> diff --git a/tests/spec/ext_transform_feedback/immediate-reuse-index-buffer.c b/tests/spec/ext_transform_feedback/immediate-reuse-index-buffer.c
> new file mode 100644
> index 0000000..cb043ae
> --- /dev/null
> +++ b/tests/spec/ext_transform_feedback/immediate-reuse-index-buffer.c
> @@ -0,0 +1,141 @@
> +/*
> + * Copyright © 2011 Intel Corporation
> + * Copyright © 2014 Advanced Micro Devices, Inc.
> + *
> + * 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 immediate-reuse-index-buffer.c
> + *
> + * Verify that if a transform feedback output buffer is immediately re-used
> + * as an index buffer (changing no GL settings except for buffer bindings),
> + * rendering is correct.
> + *
> + * The test operates by using an index buffer <-> transform feedback loop
> + * that increments the vertex index (gl_VertexID). The test starts
> + * with index 0 and transform feedback writes (gl_VertexID+1). Then it uses
> + * the output as an input again and the index (gl_VertexID) should be 1.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 256;
> + config.window_height = 16;
> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char *vstext =
> + "#version 130\n"
> + "varying vec4 out_color;\n"
> + "varying int index;\n"
> + "\n"
> + "void main()\n"
> + "{\n"
> + " int x = 8 + 16 * gl_VertexID;\n"
> + " gl_Position = vec4(x / 128.0 - 1.0, 0, 0, 1);\n"
> + " out_color = vec4(float(gl_VertexID) / 16.0, \n"
> + " float(16 - gl_VertexID) / 16.0, \n"
> + " float(gl_VertexID) / 16.0, 1.0);\n"
> + " index = gl_VertexID + 1;\n"
> + "}\n";
> +
> +static const char *fstext =
> + "#version 130\n"
> + "varying vec4 out_color;\n"
> + "\n"
> + "void main()\n"
> + "{\n"
> + " gl_FragColor = out_color;\n"
> + "}\n";
> +
> +static const char *varyings[] = { "index" };
> +
> +static GLuint bufs[2];
> +static GLuint prog;
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_gl_version(30);
> +
> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext);
> + prog = glCreateProgram();
> + glAttachShader(prog, vs);
> + glAttachShader(prog, fs);
> + glTransformFeedbackVaryings(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS);
> + glLinkProgram(prog);
> + if (!piglit_link_check_status(prog)) {
> + glDeleteProgram(prog);
> + piglit_report_result(PIGLIT_FAIL);
> + }
> +
> + glGenBuffers(2, bufs);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + int i;
> + GLboolean pass = GL_TRUE;
> + unsigned zero = 0;
> +
> + /* Setup program and initial buffer contents */
> + glBindBuffer(GL_ARRAY_BUFFER, bufs[0]);
> + glBufferData(GL_ARRAY_BUFFER, 4, &zero, GL_STREAM_COPY);
> + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufs[1]);
> + glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 4, &zero, GL_STREAM_COPY);
> +
> + glUseProgram(prog);
> + glClear(GL_COLOR_BUFFER_BIT);
> + glPointSize(16);
> +
> + /* Draw 16 times, swapping transform feedback and index data
> + * so that transform feedback output is fed back to index
> + * input.
> + */
> + for (i = 0; i < 16; ++i) {
> + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufs[i % 2]);
> + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0,
> + bufs[(i + 1) % 2]);
> + glBeginTransformFeedback(GL_POINTS);
> + glDrawElements(GL_POINTS, 1, GL_UNSIGNED_INT, NULL);
> + glEndTransformFeedback();
> + }
> +
> + /* Check that the proper gradient was drawn */
> + for (i = 0; i < 16; ++i) {
> + float expected_color[3] = {i/16.0, (16 - i)/16.0, i/16.0 };
> + pass = piglit_probe_rect_rgb(16 * i, 0, 16, 16,
> + expected_color) && pass;
> + }
> +
> + piglit_present_results();
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> --
> 2.1.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list