[Piglit] [v4 08/11] arb_transform_feedback3: add test for interleaved in max buffers

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Nov 25 08:23:52 PST 2013


On Mon, Nov 25, 2013 at 01:47:39PM +0200, Pohjolainen, Topi wrote:
> On Fri, Nov 22, 2013 at 01:47:23PM -0800, Ian Romanick wrote:
> > On 11/14/2013 04:20 AM, Topi Pohjolainen wrote:
> > > Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.
> > > 
> > > v2:
> > >    - fixed indentation: spaces -> tabs (Ian)
> > >    - require core/compatibility version 3.2 instead of
> > >      ARB_geometry_shader4 which is not going to be supported by
> > >      mesa (Ian)
> > >    - drop _EXT, use core names instead (Ian)
> > >    - now using piglit_build_simple_program_multiple_shaders()
> > > 
> > > v3:
> > >    - drop unnecessary doxygen markers in comments
> > >    - switched to hex-numbered variable names to simplify the
> > >      name generation and space allocation
> > >    - such as Ian suggested for another test, generate the
> > >      names of the varyings using 'asprintf()'
> > >    - renamed into 'ext_interleaved_max_buffers_and_varyings'
> > >    - dropped unnecessary requirements for 1.50 glsl and
> > >      arb_gpu_shader5 - former is already covered by the
> > >      GL version 3.2 and latter is simply not needed
> > >    - split varying setup logic into common source file for
> > >      other tests to use
> > > 
> > > Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> > > ---
> > >  tests/all.tests                                    |   2 +
> > >  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |   1 +
> > >  .../ext_interleaved_max_buffers_and_varyings.c     | 306 +++++++++++++++++++++
> > >  tests/spec/arb_transform_feedback3/xfb3_common.c   |  60 ++++
> > >  tests/spec/arb_transform_feedback3/xfb3_common.h   |  55 ++++
> > >  5 files changed, 424 insertions(+)
> > >  create mode 100644 tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
> > >  create mode 100644 tests/spec/arb_transform_feedback3/xfb3_common.c
> > >  create mode 100644 tests/spec/arb_transform_feedback3/xfb3_common.h
> > > 
> > > diff --git a/tests/all.tests b/tests/all.tests
> > > index 3ae92d2..2769877 100644
> > > --- a/tests/all.tests
> > > +++ b/tests/all.tests
> > > @@ -2490,6 +2490,8 @@ arb_transform_feedback3['arb_transform_feedback3-end_query_with_name_zero'] = Pl
> > >  arb_transform_feedback3['arb_transform_feedback3-draw_using_invalid_stream_index'] = PlainExecTest(['arb_transform_feedback3-draw_using_invalid_stream_index', '-auto'])
> > >  arb_transform_feedback3['arb_transform_feedback3-set_varyings_with_invalid_args'] = PlainExecTest(['arb_transform_feedback3-set_varyings_with_invalid_args', '-auto'])
> > >  arb_transform_feedback3['arb_transform_feedback3-set_invalid_varyings'] = PlainExecTest(['arb_transform_feedback3-set_invalid_varyings', '-auto'])
> > > +arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings_vs'] = PlainExecTest(['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings', '-auto', 'vs'])
> > > +arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings_gs'] = PlainExecTest(['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings', '-auto', 'gs'])
> > >  
> > >  arb_uniform_buffer_object = Group()
> > >  spec['ARB_uniform_buffer_object'] = arb_uniform_buffer_object
> > > diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> > > index 1205a07..2f1515b 100644
> > > --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> > > +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> > > @@ -14,5 +14,6 @@ piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero end_quer
> > >  piglit_add_executable (arb_transform_feedback3-draw_using_invalid_stream_index draw_using_invalid_stream_index.c)
> > >  piglit_add_executable (arb_transform_feedback3-set_varyings_with_invalid_args set_varyings_with_invalid_args.c)
> > >  piglit_add_executable (arb_transform_feedback3-set_invalid_varyings set_invalid_varyings.c)
> > > +piglit_add_executable (arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings ext_interleaved_max_buffers_and_varyings.c xfb3_common.c)
> > >  
> > >  # vim: ft=cmake:
> > > diff --git a/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c b/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
> > > new file mode 100644
> > > index 0000000..7612c3c
> > > --- /dev/null
> > > +++ b/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
> > > @@ -0,0 +1,306 @@
> > > +/*
> > > + * 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.
> > > + */
> > > +
> > > +#include "xfb3_common.h"
> > > +
> > > +/**
> > > + * @file ext_interleaved_max_buffers_and_varyings.c 
> > > + *
> > > + * Records interleaved varyings using single vertex stream into separate
> > > + * buffers. The test tries to use as many buffers the tested GL-stack can
> > > + * support trying to output the maximum amount of supported varyings evenly
> > > + * between the buffers.
> > > + * The test can be executed in two different ways: the stream originating from
> > > + * vertex shader or from single geometry shader instance.
> > > + *
> > > + * Recording both vertex shader and geometry shader outputs in parallel is not
> > > + * supported by the extension. The spec says:
> > > + *
> > > + * "When a geometry shader is active (see section 2.12), transform feedback
> > > + *  records the values of the selected geometry shader output variables from the
> > > + *  emitted vertices. Otherwise, the values of the selected vertex shader output
> > > + *  variables are recorded."
> > > + * 
> > > + * This test uses the "EXT"-style GLSL transform feedback.
> > > + */
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > > +
> > > +	config.supports_gl_compat_version = 32;
> > > +	config.supports_gl_core_version = 32;
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_END
> > > +
> > > +/**
> > > + * Generates a shader program body between the given prologue and epilogue
> > > + * containing declarations and assignments for 'n' variables.
> > > + * In order to ease the generation and space allocation, the variables are
> > > + * formatted for even length using hexadecimal running number in the variable
> > > + * name:
> > > + *
> > > + * out float x_00000000;
> > > + * out float x_00000001;
> > > + * ...
> > > + * out float x_00000(n);
> > > + *
> > > + * void main() {
> > > + *   x_00000000 = 0.0;
> > > + *   x_00000001 = 1.0;
> > > + *   ...
> > > + *   x_00000(n) = (n).0;
> > > + * }
> > > + */
> > 
> > I /think/ the code can be similified a lot.  Tell me what you think.
> > Have generate shader be something like:
> > 
> > static char *
> > generate_shader(const char *prologue, const char *emit, unsigned n)
> > {
> >     static const char template[] =
> > 	"#version 150;\n
> > 	"%s"
> > 	"out float x[%d];\n"
> > 	"\n"
> > 	"void main()\n"
> > 	"{\n"
> > 	"    for (int i = 0; i < x.length(); i++)\n"
> > 	"        x[i] = float(i);\n"
> > 	"    %s;\n"
> > 	"}\n"
> > 	;
> > 
> >     char *s = NULL;
> > 
> >     asprintf(&s, template, n, emit);
> >     return s;
> > }
> > 
> > static char *
> > generate_geometry_shader(unsigned n)
> > {
> >     return generate_shader("layout(points) in;\nlayout(points,
> > max_vertices = 1) out;\n",
> >                            "EmitVertex()",
> >                            n);
> > }
> > 
> > // ...
> > 
> > That would necessitate some changes in setup_varyings, but I think they
> > would be fairly simple.
> 
> Thanks Ian, your approach looks a lot better - I'll give it a try.

Indeed it became really simple - the changes to setup_varyings() were really
simple as well.

> 
> > 
> > I believe that would also mean the next patch would need similar treatment.
> 
> There it may not be that straight-forward as there needs to be specific
> 'EmitStreamVertex(index)' line where the 'index' needs to be a constant integer
> and hence a loop variable won't do. Your proposal should simplify it in any
> case though.

But here it becomes more difficult as each varying has to be associated with
the vertex stream (otherwise there would be no way for the pipeline to know
how streams and varyings are associated). Either the varying declaration
depends on the current default setting or it is explicit in the declaration of
the varying. The spec says:

   "Each output block or non-block output variable is associated with a vertex
    stream.  If the block or variable is declared with a stream qualifier, it
    is associated with the specified stream; otherwise, it is associated with
    the current default stream.  A block member may be declared with a stream
    qualifier, but the specified stream must match the stream associated with
    the containing block.  One example:

      layout(stream=1) out;             // default is now stream 1
      out vec4 var1;                    // var1 gets default stream (1)
      layout(stream=2) out Block1 {     // "Block1" belongs to stream 2
        layout(stream=2) vec4 var2;     // redundant block member stream decl
        layout(stream=3) vec2 var3;     // ILLEGAL (must match block stream)
        vec3 var4;                      // belongs to stream 2
      };
      layout(stream=0) out;             // default is now stream 0
      out vec4 var5;                    // var5 gets default stream (0)
      out Block2 {                      // "Block2" gets default stream (0)
        vec4 var6;
      };
      layout(stream=3) out vec4 var7;   // var7 belongs to stream 3"

Hence I don't think the trick with an array works with multiple streams - all
elements in an array must be output to the same vertex stream as the array
itself is declared in the scope of one specific stream only.

> 
> > 
> > > +static char *
> > > +generate_shader(const char *prologue, unsigned prologue_len,
> > > +		const char *epilogue, unsigned epilogue_len,
> > > +		unsigned n)
> > > +{
> > > +	unsigned i;
> > > +	char *res;
> > > +	char *curr;
> > > +	static const char output_decl_tmpl[] = "out float x_%08x;\n";
> > > +	static const char output_assign_tmpl[] = "  x_%08x = %u.0;\n";
> > > +	static const char main_opening[] = "void main() {\n";
> > > +	/*
> > > +	 * Variable names are formatted using "x_%08x" as template. This
> > > +	 * requires eight bytes of space for the running number part.
> > > +	 * */
> > > +	static const unsigned int_extra = 8 - 4 /* strlen("%08x") */;
> > > +
> > > +	curr = res = malloc(prologue_len + sizeof(main_opening) +
> > > +			n * (sizeof(output_decl_tmpl) + int_extra +
> > > +			     sizeof(output_assign_tmpl) + 2 * int_extra) +
> > > +			epilogue_len);
> > > +
> > > +	curr += snprintf(curr, prologue_len, prologue);
> > > +
> > > +	for (i = 0; i < n; ++i)
> > > +		curr += sprintf(curr, output_decl_tmpl, i);
> > > +
> > > +	curr += sprintf(curr, main_opening);
> > > +
> > > +	for (i = 0; i < n; ++i)
> > > +		curr += sprintf(curr, output_assign_tmpl, i, i);
> > > +
> > > +	curr += snprintf(curr, epilogue_len, epilogue);
> > > +
> > > +	return res;
> > > +}
> > > +
> > > +static char *
> > > +generate_geometry_shader(unsigned n)
> > > +{
> > > +	static const char prologue[] =
> > > +		"#version 150\n"
> > > +		"layout(points) in;\n"
> > > +		"layout(points, max_vertices = 1) out;\n";
> > > +	static const char epilogue[] = "  EmitVertex();\n}\n";
> > > +
> > > +	return generate_shader(prologue, sizeof(prologue),
> > > +			epilogue, sizeof(epilogue), n);
> > > +}
> > > +
> > > +static char *
> > > +generate_vertex_shader(unsigned n)
> > > +{
> > > +	static const char prologue[] = "#version 150\n";
> > > +	static const char epilogue[] = "  }\n";
> > > +
> > > +	return generate_shader(prologue, sizeof(prologue),
> > > +			epilogue, sizeof(epilogue), n);
> > > +}
> > > +
> > > +static void
> > > +build_and_use_program(bool use_gs, unsigned n_bufs, unsigned n_vars_per_buf)
> > > +{
> > > +	GLuint prog;
> > > +
> > > +	if (use_gs) {
> > > +		char *gs_text = generate_geometry_shader(
> > > +					n_bufs * n_vars_per_buf);
> > > +		prog = piglit_build_simple_program_multiple_shaders(
> > > +				GL_VERTEX_SHADER, vs_pass_thru_text,
> > > +				GL_GEOMETRY_SHADER, gs_text, 0);
> > > +		free(gs_text);
> > > +	} else {
> > > +		char *vs_text = generate_vertex_shader(n_bufs * n_vars_per_buf);
> > > +		prog = piglit_build_simple_program_multiple_shaders(
> > > +				GL_VERTEX_SHADER, vs_text, 0);
> > > +		free(vs_text);
> > > +	}
> > > +
> > > +	/*
> > > +	 * In the EXT-style the recorded varyings need to be set before linking.
> > > +	 */
> > > +	setup_varyings(prog, n_bufs, n_vars_per_buf);
> > > +
> > > +	if (!piglit_check_gl_error(GL_NO_ERROR))
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +
> > > +	glLinkProgram(prog);
> > > +	if (!piglit_link_check_status(prog))
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	if (!piglit_check_gl_error(GL_NO_ERROR))
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +
> > > +	glUseProgram(prog);
> > > +}
> > > +
> > > +static bool
> > > +probe_buffers(GLuint *xfb, unsigned n_bufs, unsigned n_vars_per_buf)
> > > +{
> > > +	int i, j;
> > > +	bool pass = true;
> > > +	float *expected = malloc(n_vars_per_buf * sizeof(float));
> > > +
> > > +	for (i = 0; i < n_bufs; ++i) {
> > > +		char label[32];
> > > +
> > > +		sprintf(label, "buf[%u]", i);
> > > +
> > > +		for (j = 0; j < n_vars_per_buf; ++j)
> > > +			expected[j] = (i * n_vars_per_buf) + j;
> > > +
> > > +		pass = piglit_probe_buffer(xfb[i],
> > > +				GL_TRANSFORM_FEEDBACK_BUFFER, label, 1,
> > > +				n_vars_per_buf, expected) && pass;
> > > +	}
> > > +
> > > +	free(expected);
> > > +
> > > +	return pass;
> > > +}
> > > +
> > > +static void
> > > +check_driver(GLint *max_bufs, GLint *max_xfb_comps)
> > > +{
> > > +	piglit_require_extension("GL_ARB_transform_feedback3");
> > > +
> > > +	glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, max_bufs);
> > > +	glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
> > > +		max_xfb_comps);
> > > +
> > > +	if (!*max_bufs || !*max_xfb_comps) {
> > > +		printf("Maximum amount of buffers and components need to be"
> > > +			"positive (%u:%u).\n", *max_bufs, *max_xfb_comps);
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	}
> > > +
> > > +	/* Get the number of varyings - each consumes four components */
> > > +	*max_xfb_comps /= 4;
> > > +
> > > +	if (*max_bufs > *max_xfb_comps) {
> > > +		printf("Maximum amount of buffers exceeds maximum amount of "
> > > +			"varyings (%u:%u).\n", *max_bufs, *max_xfb_comps);
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	}
> > > +}
> > > +
> > > +static bool
> > > +use_gs(int argc, char **argv)
> > > +{
> > > +	bool use_gs = false;
> > > +	bool print_usage = argc != 2;
> > > +
> > > +	if (!print_usage) {
> > > +		if (strcmp(argv[1], "gs") == 0)
> > > +			use_gs = true;
> > > +		else if (strcmp(argv[1], "vs") != 0)
> > > +			print_usage = true;
> > > +	}
> > > +
> > > +	if (print_usage) {
> > > +		printf("Usage: %s <subtest>\n"
> > > +		       "  where <subtest> is one of the following:\n"
> > > +		       "    gs\n"
> > > +		       "    vs\n", argv[0]);
> > > +
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	}
> > > +
> > > +	return use_gs;
> > > +}
> > > +
> > > +void
> > > +piglit_init(int argc, char **argv)
> > > +{
> > > +	bool pass;
> > > +	int i;
> > > +	GLuint *xfb;
> > > +	GLint max_bufs, max_xfb_comps;
> > > +	GLuint vao;
> > > +
> > > +	check_driver(&max_bufs, &max_xfb_comps);
> > > +
> > > +	build_and_use_program(use_gs(argc, argv), max_bufs,
> > > +			max_xfb_comps / max_bufs);
> > > +
> > > +	xfb = malloc(max_bufs * sizeof(GLuint));
> > > +
> > > +	/* Set up the transform feedback buffers. */
> > > +	glGenBuffers(max_bufs, xfb);
> > > +	for (i = 0; i < max_bufs; ++i) {
> > > +		glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, i, xfb[i]);
> > > +		glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,
> > > +			(max_xfb_comps / max_bufs) * sizeof(float), NULL,
> > > +			GL_STREAM_READ);
> > > +	}
> > > +
> > > +	/* Test only records using transform feedback. */
> > > +	glEnable(GL_RASTERIZER_DISCARD);
> > > +
> > > +	if (!piglit_check_gl_error(GL_NO_ERROR)) {
> > > +		glDeleteBuffers(max_bufs, xfb);
> > > +		free(xfb);
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	}
> > > +
> > > +	/* Test is run under desktop OpenGL 3.2 -> use of VAOs is required */
> > > +	glGenVertexArrays(1, &vao);
> > > +	glBindVertexArray(vao);
> > > +
> > > +	/* Draw and record */
> > > +	glBeginTransformFeedback(GL_POINTS);
> > > +	glDrawArrays(GL_POINTS, 0, 1);
> > > +	glEndTransformFeedback();
> > > +	glDeleteVertexArrays(1, &vao);
> > > +
> > > +	if (!piglit_check_gl_error(GL_NO_ERROR)) {
> > > +		glDeleteBuffers(max_bufs, xfb);
> > > +		free(xfb);
> > > +		piglit_report_result(PIGLIT_FAIL);
> > > +	}
> > > +
> > > +	pass = probe_buffers(xfb, max_bufs, max_xfb_comps / max_bufs);
> > > +	glDeleteBuffers(max_bufs, xfb);
> > > +	free(xfb);
> > > +
> > > +	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> > > +}
> > > +
> > > +enum piglit_result
> > > +piglit_display(void)
> > > +{
> > > +	/* Should never be reached */
> > > +	return PIGLIT_FAIL;
> > > +}
> > > diff --git a/tests/spec/arb_transform_feedback3/xfb3_common.c b/tests/spec/arb_transform_feedback3/xfb3_common.c
> > > new file mode 100644
> > > index 0000000..22918e1
> > > --- /dev/null
> > > +++ b/tests/spec/arb_transform_feedback3/xfb3_common.c
> > > @@ -0,0 +1,60 @@
> > > +/*
> > > + * 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.
> > > + */
> > > +
> > > +#include "xfb3_common.h"
> > > +
> > > +void
> > > +setup_varyings(GLuint prog, unsigned n, unsigned m)
> > > +{
> > > +	/* Every 'n' buffers are separated by 'n - 1' separator strings */
> > > +	const unsigned var_n = n * (m + 1) - 1;
> > > +	const char **vars;
> > > +	unsigned i, j;
> > > +
> > > +	vars = (const char**)malloc(var_n * sizeof(const char *));
> > > +
> > > +	for (i = 0; i < n; ++i) {
> > > +		if (i != 0) {
> > > +			static const char separator[] = "gl_NextBuffer";
> > > +			vars[i * (m + 1) - 1] = separator;
> > > +		}
> > > +
> > > +		for (j = 0; j < m; ++j)
> > > +			asprintf((char **)&vars[i * (m + 1) + j],
> > > +				"x_%08x", i * m + j);
> > > +	}
> > > +
> > > +	/*
> > > +	 * It should be noticed that when mixed mode is used, i.e., where one
> > > +	 * records multiple attributes per buffer but also uses separate
> > > +	 * buffers, the mode must be set to interleaved.
> > > +	 */
> > > +	glTransformFeedbackVaryings(prog, var_n, vars, GL_INTERLEAVED_ATTRIBS);
> > > +
> > > +	for (i = 0; i < n; ++i) {
> > > +		for (j = 0; j < m; ++j)
> > > +			free((char *)vars[i * (m + 1) + j]);
> > > +	}
> > > +
> > > +	free(vars);
> > > +}
> > > diff --git a/tests/spec/arb_transform_feedback3/xfb3_common.h b/tests/spec/arb_transform_feedback3/xfb3_common.h
> > > new file mode 100644
> > > index 0000000..5211080
> > > --- /dev/null
> > > +++ b/tests/spec/arb_transform_feedback3/xfb3_common.h
> > > @@ -0,0 +1,55 @@
> > > +/*
> > > + * 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.
> > > + */
> > > +#ifndef XFB3_COMMON_H
> > > +#define XFB3_COMMON_H
> > > +
> > > +#include "piglit-util-gl-common.h"
> > > +
> > > +static const char vs_pass_thru_text[] =
> > > +	"#version 150\n"
> > > +	"void main() {\n"
> > > +	"  gl_Position = vec4(0.0);\n"
> > > +	"}\n";
> > > +
> > > +/**
> > > + * Setup varying name array containing 'n' sets of 'm' variables. Sets are
> > > + * separated by "gl_NextBuffer" telling GL-stack to record variables in each
> > > + * set into separate buffers.
> > > + * 
> > > + * [0     ]: "x_00000000"
> > > + * [1     ]: "x_00000001"
> > > + * ...
> > > + * [m  - 1]: "x_00(m - 1)"
> > > + * [m     ]: "gl_NextBuffer"
> > > + * [m  + 1]: "x_00(m + 1)"
> > > + * [m  + 2]: "x_00(m + 2)"
> > > + * ...
> > > + * [2m    ]: "x_(2 * m - 1)"
> > > + * [2m + 1]: "gl_NextBuffer"
> > > + * ...
> > > + * [n * (m + 1) - 1]: "x_(n * m - 1)"
> > > + */
> > > +void
> > > +setup_varyings(GLuint prog, unsigned n, unsigned m);
> > > +
> > > +#endif /* XFB3_COMMON_H */
> > > 
> > 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list