[Piglit] [PATCH 09/18] shader_runner: Extend fb tex 2d command to support binding multiple render targets.

Francisco Jerez currojerez at riseup.net
Tue Oct 18 23:36:35 UTC 2016


fb tex 2d now takes a variable number of texture indices that are
bound sequentially as texture attachments of the framebuffer object.
---
 tests/shaders/shader_runner.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c315676..7151fd2 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2968,23 +2968,32 @@ piglit_display(void)
 			GLuint fbo = 0;
 
 			if (parse_str(rest, "tex 2d ", &rest)) {
+				GLenum attachments[32];
+				unsigned num_attachments = 0;
+
 				glGenFramebuffers(1, &fbo);
 				glBindFramebuffer(target, fbo);
 
-				REQUIRE(parse_int(rest, &tex, &rest),
-					"Framebuffer binding command not "
-					"understood at: %s\n", rest);
-
-				glFramebufferTexture2D(
-					target, GL_COLOR_ATTACHMENT0,
-					GL_TEXTURE_2D,
-					get_texture_binding(tex)->obj, 0);
-				if (!piglit_check_gl_error(GL_NO_ERROR)) {
-					fprintf(stderr,
-						"glFramebufferTexture2D error\n");
-					piglit_report_result(PIGLIT_FAIL);
+				while (parse_int(rest, &tex, &rest)) {
+					attachments[num_attachments] =
+						GL_COLOR_ATTACHMENT0 + num_attachments;
+					glFramebufferTexture2D(
+						target, attachments[num_attachments],
+						GL_TEXTURE_2D,
+						get_texture_binding(tex)->obj, 0);
+
+					if (!piglit_check_gl_error(GL_NO_ERROR)) {
+						fprintf(stderr,
+							"glFramebufferTexture2D error\n");
+						piglit_report_result(PIGLIT_FAIL);
+					}
+
+					num_attachments++;
 				}
 
+				if (target != GL_READ_FRAMEBUFFER)
+					glDrawBuffers(num_attachments, attachments);
+
 				w = get_texture_binding(tex)->width;
 				h = get_texture_binding(tex)->height;
 
-- 
2.9.0



More information about the Piglit mailing list