[Piglit] [PATCH] Basic test that transform feedback works with geometry shaders.
Paul Berry
stereotype441 at gmail.com
Mon Aug 19 08:15:16 PDT 2013
On 16 August 2013 11:57, Ian Romanick <idr at freedesktop.org> wrote:
> Assuming we'll have tougher tests later, this test is
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> On side comment below...
>
>
> On 08/07/2013 10:15 AM, Paul Berry wrote:
>
>> ---
>> tests/all.tests | 2 +
>> .../spec/ext_transform_**feedback/CMakeLists.gl.txt | 1 +
>> .../geometry-shaders-basic.c | 171
>> +++++++++++++++++++++
>> 3 files changed, 174 insertions(+)
>> create mode 100644 tests/spec/ext_transform_**
>> feedback/geometry-shaders-**basic.c
>>
>> diff --git a/tests/all.tests b/tests/all.tests
>> index 2f32120..bf46ae1 100644
>> --- a/tests/all.tests
>> +++ b/tests/all.tests
>> @@ -2116,6 +2116,8 @@ for api_suffix, possible_options in [('', [[],
>> ['interface']]),
>> api_suffix, ' '.join(args))
>> ext_transform_feedback[test_**name] =
>> concurrent_test(
>> 'ext_transform_feedback-{0}'.**
>> format(test_name))
>> +ext_transform_feedback['**geometry-shaders-basic'] = concurrent_test(
>> + 'ext_transform_feedback-**geometry-shaders-basic')
>>
>> arb_transform_feedback2 = Group()
>> spec['ARB_transform_feedback2'**] = arb_transform_feedback2
>> diff --git a/tests/spec/ext_transform_**feedback/CMakeLists.gl.txt
>> b/tests/spec/ext_transform_**feedback/CMakeLists.gl.txt
>> index e881033..1d03abd 100644
>> --- a/tests/spec/ext_transform_**feedback/CMakeLists.gl.txt
>> +++ b/tests/spec/ext_transform_**feedback/CMakeLists.gl.txt
>> @@ -21,6 +21,7 @@ piglit_add_executable (ext_transform_feedback-**discard-copypixels
>> discard-copypix
>> piglit_add_executable (ext_transform_feedback-**discard-drawarrays
>> discard-drawarrays.c)
>> piglit_add_executable (ext_transform_feedback-**discard-drawpixels
>> discard-drawpixels.c)
>> piglit_add_executable (ext_transform_feedback-**generatemipmap
>> generatemipmap.c)
>> +piglit_add_executable (ext_transform_feedback-**geometry-shaders-basic
>> geometry-shaders-basic.c)
>> piglit_add_executable (ext_transform_feedback-get-**buffer-state
>> get-buffer-state.c)
>> piglit_add_executable (ext_transform_feedback-**position position.c)
>> piglit_add_executable (ext_transform_feedback-**immediate-reuse
>> immediate-reuse.c)
>> diff --git a/tests/spec/ext_transform_**feedback/geometry-shaders-**basic.c
>> b/tests/spec/ext_transform_**feedback/geometry-shaders-**basic.c
>> new file mode 100644
>> index 0000000..ad63dc1
>> --- /dev/null
>> +++ b/tests/spec/ext_transform_**feedback/geometry-shaders-**basic.c
>> @@ -0,0 +1,171 @@
>> +/*
>> + * Copyright © 2013 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 geometry-shaders-basic.c
>> + *
>> + * Verify basic functionality of transform feedback when a geometry
>> + * shader is in use.
>> + *
>> + * This test checks that:
>> + *
>> + * - The number of primitives counted by GL_PRIMITIVES_GENERATED and
>> + * GL_TRANSFORM_FEEDBACK_**PRIMITIVES_WRITTEN is based on the number
>> + * of geometry shader output vertices (rather than the number of
>> + * primitives sent down the pipeline).
>> + *
>> + * - Data output by the geometry shader is properly recorded in the
>> + * transform feedback buffer.
>> + */
>> +
>> +#include "piglit-util-gl-common.h"
>> +
>> +#define GEOM_OUT_VERTS 10
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> + config.supports_gl_compat_**version = 32;
>> + config.supports_gl_core_**version = 32;
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +static const char *vstext =
>> + "#version 150\n"
>> + "in int vertex_count;\n"
>> + "out int vertex_count_to_gs;\n"
>> + "\n"
>> + "void main()\n"
>> + "{\n"
>> + " vertex_count_to_gs = vertex_count;\n"
>> + "}\n";
>> +
>> +static const char *gstext =
>> + "#version 150\n"
>> + "layout(points) in;\n"
>> + "layout(points, max_vertices=10) out;\n"
>> + "in int vertex_count_to_gs[1];\n"
>> + "out int vertex_id;\n"
>> + "\n"
>> + "void main()\n"
>> + "{\n"
>> + " for (int i = 0; i < vertex_count_to_gs[0]; i++) {\n"
>> + " vertex_id = i;\n"
>> + " EmitVertex();\n"
>> + " }\n"
>> + "}\n";
>> +
>> +static const char *varyings[] = { "vertex_id" };
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> + GLint vertex_data[1] = { GEOM_OUT_VERTS };
>> + bool pass = true;
>> + GLuint vs, gs, prog, array_buf, query_result, xfb_buf,
>> generated_query,
>> + written_query, vao;
>> + GLint vertex_count_loc;
>> + const GLint *readback;
>> + int i;
>> +
>> + vs = piglit_compile_shader_text(GL_**VERTEX_SHADER, vstext);
>> + gs = piglit_compile_shader_text(GL_**GEOMETRY_SHADER, gstext);
>> + prog = glCreateProgram();
>> + glAttachShader(prog, vs);
>> + glAttachShader(prog, gs);
>> + glTransformFeedbackVaryings(**prog, 1, varyings,
>> GL_INTERLEAVED_ATTRIBS);
>> + glLinkProgram(prog);
>> + if (!piglit_link_check_status(**prog)) {
>> + glDeleteProgram(prog);
>> + piglit_report_result(PIGLIT_**FAIL);
>> + }
>>
>
> I have seen or written code like this lots of places in piglit. I think
> we need a piglit_build_simple_program_**unlinked that does everything
> upto the glLinkProgram call.
Yeah, that's a good point. I'll do that as a follow-up.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130819/270f8f47/attachment-0001.html>
More information about the Piglit
mailing list