[1/2] shader_runner: Improve MS texture support

Submitted by Rhys Perry on July 20, 2018, 3:36 p.m.

Details

Message ID fe7728d853dfce500ebf8fbd831c2dce1f7e6d6b.1532100854.git.pendingchaos02@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Rhys Perry July 20, 2018, 3:36 p.m.
---
 tests/shaders/shader_runner.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c1d4c9265..96f009277 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3149,6 +3149,7 @@  piglit_display(void)
 			if (parse_str(rest, "tex 2d ", &rest)) {
 				GLenum attachments[32];
 				unsigned num_attachments = 0;
+				bool ms = parse_str(rest, "ms ", &rest);
 
 				glGenFramebuffers(1, &fbo);
 				glBindFramebuffer(target, fbo);
@@ -3158,7 +3159,7 @@  piglit_display(void)
 						GL_COLOR_ATTACHMENT0 + num_attachments;
 					glFramebufferTexture2D(
 						target, attachments[num_attachments],
-						GL_TEXTURE_2D,
+						ms ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D,
 						get_texture_binding(tex)->obj, 0);
 
 					if (!piglit_check_gl_error(GL_NO_ERROR)) {
@@ -3685,6 +3686,21 @@  piglit_display(void)
 				     w, h, l, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
 			set_texture_binding(tex, texobj, w, h, l);
 
+		} else if (sscanf(line,
+				  "texture junk 2DMS %d ( %d , %d , %d )",
+				  &tex, &w, &h, &l) == 4) {
+			GLuint texobj;
+			glActiveTexture(GL_TEXTURE0 + tex);
+			glGenTextures(1, &texobj);
+			glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texobj);
+			if (piglit_is_gles())
+				glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, l, GL_RGBA,
+				                          w, h, GL_FALSE);
+			else
+				glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, l, GL_RGBA,
+				                        w, h, GL_FALSE);
+			set_texture_binding(tex, texobj, w, h, 1);
+
 		} else if (parse_str(line, "texture storage ", &rest)) {
 			GLenum target, format;
 			GLuint tex_obj;