[Piglit] [PATCH 3/5] fbo-drawbuffers-none: Refactor the code to add a sub test

Anuj Phogat anuj.phogat at gmail.com
Mon May 19 13:51:39 PDT 2014


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
index a560667..10cc133 100644
--- a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
+++ b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
@@ -106,15 +106,17 @@ static const char *fs_write_red =
 	"   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); \n"
 	"}\n";
 
-static const char *fs_write_different =
+static const char *fs_template_write_different =
+	"#define OUTVAR %s \n"
 	"void main() \n"
 	"{ \n"
-	"   gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0); \n"
-	"   gl_FragData[1] = vec4(0.0, 1.0, 0.0, 1.0); \n"
-	"   gl_FragData[2] = vec4(0.0, 0.0, 1.0, 1.0); \n"
-	"   gl_FragData[3] = vec4(1.0, 1.0, 0.0, 1.0); \n"
+	"   OUTVAR[0] = vec4(1.0, 0.0, 0.0, 1.0); \n"
+	"   OUTVAR[1] = vec4(0.0, 1.0, 0.0, 1.0); \n"
+	"   OUTVAR[2] = vec4(0.0, 0.0, 1.0, 1.0); \n"
+	"   OUTVAR[3] = vec4(1.0, 1.0, 0.0, 1.0); \n"
 	"}\n";
 
+static char *fs_write_different;
 static char *test_name, *prog_name;
 static GLuint fb, prog_write_all_red, prog_write_all_different;
 
@@ -127,6 +129,9 @@ create_shaders(void)
 				GL_FRAGMENT_SHADER, fs_write_red,
 				0);
 
+	asprintf(&fs_write_different, fs_template_write_different,
+		 "gl_FragData");
+
 	prog_write_all_different = piglit_build_simple_program_multiple_shaders(
 				GL_VERTEX_SHADER, vs,
 				GL_FRAGMENT_SHADER, fs_write_different,
-- 
1.8.3.1



More information about the Piglit mailing list