[Piglit] [PATCH 1/4] Add functionality to create a FBO with multisample texture attachment

Anuj Phogat anuj.phogat at gmail.com
Wed May 1 14:08:28 PDT 2013


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/spec/ext_framebuffer_multisample/common.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index c58ba3b..65f98f7 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -194,7 +194,7 @@ Fbo::try_setup(const FboConfig &new_config)
 			glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
 						  GL_COLOR_ATTACHMENT0,
 						  GL_RENDERBUFFER, color_rb);
-		} else {
+		} else if (config.num_samples == 0) {
 			piglit_require_extension("GL_ARB_texture_rectangle");
 			glBindTexture(GL_TEXTURE_RECTANGLE, color_tex);
 			glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER,
@@ -215,6 +215,21 @@ Fbo::try_setup(const FboConfig &new_config)
 					       GL_TEXTURE_RECTANGLE,
 					       color_tex,
 					       0 /* level */);
+		} else {
+			piglit_require_extension("GL_ARB_texture_multisample");
+			glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, color_tex);
+			glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+						config.num_samples,
+						config.color_internalformat,
+						config.width,
+						config.height,
+						GL_TRUE /* fixed sample locations */);
+
+			glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
+					       GL_COLOR_ATTACHMENT0,
+					       GL_TEXTURE_2D_MULTISAMPLE,
+					       color_tex,
+					       0 /* level */);
 		}
 	}
 
-- 
1.8.1.4



More information about the Piglit mailing list