[Piglit] [PATCH] fbo: Fix broken MRT bindings test.

Ilia Mirkin imirkin at alum.mit.edu
Wed Feb 18 23:06:23 PST 2015


On Thu, Feb 19, 2015 at 2:01 AM, Matt Turner <mattst88 at gmail.com> wrote:
> The code declared GLuint textures[4] and then proceeded to do things
> like glGenTextures(5, textures) and access textures[4]. Presumably the
> intention was to declare an array of size 5.
> ---
> Vinson pointed out that this test was broken a month ago...
>
>  tests/fbo/fbo-mrt-new-bind.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/fbo/fbo-mrt-new-bind.c b/tests/fbo/fbo-mrt-new-bind.c
> index 8e006b5..18c36c5 100644
> --- a/tests/fbo/fbo-mrt-new-bind.c
> +++ b/tests/fbo/fbo-mrt-new-bind.c
> @@ -46,7 +46,7 @@ PIGLIT_GL_TEST_CONFIG_END
>  GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
>  GLuint fbos[3];
>  GLint prog0, prog1;
> -GLuint textures[4];
> +GLuint textures[5];

Yes.

>
>  void
>  piglit_init(int argc, char **argv)
> @@ -56,7 +56,7 @@ piglit_init(int argc, char **argv)
>         piglit_require_GLSL_version(130);
>
>         glGenTextures(5, textures);
> -       for (i=0; i<4; i++) {
> +       for (i = 0; i < ARRAY_SIZE(textures); i++) {

No. The code below does

    glBindTexture(GL_TEXTURE_2D, textures[4]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, 640, 360, 0,
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);

The loop is just there to initialize the 4 color textures.

>             glBindTexture(GL_TEXTURE_2D, textures[i]);
>             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
>             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
> --
> 2.0.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list