[Piglit] [PATCH 11/18] shader_runner: Add multisample framebuffer binding command.

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


"fb ms <format> <width> <height> <samples>" binds a fresh multisample
framebuffer object with the given format and dimensions.
---
 tests/shaders/shader_runner.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7123c1a..fcf77d1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3080,6 +3080,36 @@ piglit_display(void)
 				w = get_texture_binding(tex)->width;
 				h = get_texture_binding(tex)->height;
 
+			} else if (parse_str(rest, "ms ", &rest)) {
+				GLuint rb;
+				GLenum format;
+				int samples;
+
+				REQUIRE(parse_enum_gl(rest, &format, &rest) &&
+					parse_int(rest, &w, &rest) &&
+					parse_int(rest, &h, &rest) &&
+					parse_int(rest, &samples, &rest),
+					"Framebuffer binding command not "
+					"understood at: %s\n", rest);
+
+				glGenFramebuffers(1, &fbo);
+				glBindFramebuffer(target, fbo);
+
+				glGenRenderbuffers(1, &rb);
+				glBindRenderbuffer(GL_RENDERBUFFER, rb);
+
+				glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
+								 format, w, h);
+
+				glFramebufferRenderbuffer(target,
+							  GL_COLOR_ATTACHMENT0,
+							  GL_RENDERBUFFER, rb);
+
+				if (!piglit_check_gl_error(GL_NO_ERROR)) {
+					fprintf(stderr, "glFramebufferRenderbuffer error\n");
+					piglit_report_result(PIGLIT_FAIL);
+				}
+
 			} else {
 				fprintf(stderr, "Unknown fb bind subcommand "
 					"\"%s\"\n", rest);
-- 
2.9.0



More information about the Piglit mailing list