[Piglit] [PATCH 4/7] arb_vertex_attrib_binding: Test switching buffers

Eric Anholt eric at anholt.net
Wed Oct 30 19:02:50 CET 2013


Fredrik Höglund <fredrik at kde.org> writes:

> This test verifies that switching vertex buffers between draw calls
> works as expected.

> diff --git a/tests/spec/arb_vertex_attrib_binding/buffers.c b/tests/spec/arb_vertex_attrib_binding/buffers.c
> new file mode 100644
> index 0000000..bba8c17
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/buffers.c

> +/**
> + * @file buffers.c
> + *
> + * Tests that switching buffers between draw calls works as expected.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_compat_version = 10;
> +
> +	config.window_width = 128;
> +	config.window_height = 128;

core, drop sizes

> +	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;

Oops, I didn't notice that in the previous test and this one, you should
have PIGLIT_GL_VISUAL_ALPHA, since you're using probe_rgba.  Of course,
your colors happen to have alpha of 1, so it ends up working out, but
let's be consistent.

> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *vs_source =
> +	"attribute vec4 pos;\n"
> +	"attribute vec4 color;\n"
> +	"varying vec4 col;\n"
> +	"void main() {\n"
> +	"    col = color;\n"
> +	"    gl_Position = pos;\n"
> +	"}";
> +
> +const char *fs_source =
> +	"varying vec4 col;\n"
> +	"void main() {\n"
> +	"    gl_FragColor = col;\n"
> +	"}";
> +
> +struct Vertex
> +{
> +	float pos[2];
> +	unsigned char color[4];
> +};

lower case

> +	pass = piglit_probe_pixel_rgba(piglit_width * .25, piglit_height * .75, red);
> +	pass = piglit_probe_pixel_rgba(piglit_width * .75, piglit_height * .75, green);
> +	pass = piglit_probe_pixel_rgba(piglit_width * .25, piglit_height * .25, blue);
> +	pass = piglit_probe_pixel_rgba(piglit_width * .75, piglit_height * .25, white);

probe_rect?

> +
> +	piglit_present_results();
> +
> +	glDeleteBuffers(1, &vbo1);
> +	glDeleteBuffers(1, &vbo2);
> +	glDeleteBuffers(1, &ibo);
> +
> +	glDeleteVertexArrays(1, &vao);
> +
> +	glUseProgram(0);
> +
> +	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	GLuint vs, fs;
> +
> +	piglit_require_extension("GL_ARB_vertex_attrib_binding");
> +
> +	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> +	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> +	program = piglit_link_simple_program(vs, fs);

piglit_build_simple_program
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131030/614ad3a3/attachment.pgp>


More information about the Piglit mailing list