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

Matt Turner mattst88 at gmail.com
Wed Feb 18 23:01:21 PST 2015


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];
 
 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++) {
 	    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



More information about the Piglit mailing list