[Piglit] [PATCH 7/7] arb_vertex_attrib_binding: Test zero-stride bindings
Eric Anholt
eric at anholt.net
Wed Oct 30 19:20:03 CET 2013
Fredrik Höglund <fredrik at kde.org> writes:
> diff --git a/tests/spec/arb_vertex_attrib_binding/zero-stride.c b/tests/spec/arb_vertex_attrib_binding/zero-stride.c
> new file mode 100644
> index 0000000..83b56e4
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/zero-stride.c
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 128;
> + config.window_height = 128;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
core, drop size, alpha
> +enum piglit_result
> +piglit_display(void)
> +{
> + const struct {
> + float x, y;
> + } verts[] = {
> + { -1, 1 }, { 1, 1 },
> + { -1, -1 }, { 1, -1 }
> + };
> +
> + const float green[] = { 0.0, 1.0, 0.0, 1.0 };
> +
> + GLuint vbo1, vbo2, vao;
> + bool pass = true;
> +
> + glGenVertexArrays(1, &vao);
> + glBindVertexArray(vao);
> +
> + glGenBuffers(1, &vbo1);
> + glGenBuffers(1, &vbo2);
> +
> + /* vbo1 contains the vertex positions */
> + glBindBuffer(GL_ARRAY_BUFFER, vbo1);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), (const GLvoid *) verts, GL_STATIC_DRAW);
> +
> + /* vbo2 contains the color data */
> + glBindBuffer(GL_ARRAY_BUFFER, vbo2);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(green), (const GLvoid *) green, GL_STATIC_DRAW);
I'd fill the color buffer with some junk after it (such as a red color),
so if the implementation is clamping buffer element indices to the size
of the buffer, you don't just get green.
> + pass = piglit_probe_pixel_rgba(piglit_width * .5, piglit_height * .5, green);
probe_rect.
> +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);
build_simple_program()
For the tests with minor comments, with the obvious fixups they're:
Reviewed-by: Eric Anholt <eric at anholt.net>
I think 2/7 was the only one I really didn't review well. Thanks for
writing a really solid set of tests for this extension!
-------------- 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/7d7deea5/attachment.pgp>
More information about the Piglit
mailing list