[Piglit] [PATCH 2/2] Make use of piglit_build_simple_program_unlinked() in some tests.

Paul Berry stereotype441 at gmail.com
Tue Aug 20 07:20:21 PDT 2013


---
 tests/spec/ext_framebuffer_multisample/common.cpp              |  6 +-----
 tests/spec/ext_texture_array/compressed.c                      |  6 +-----
 tests/spec/ext_transform_feedback/change-size.c                |  5 +----
 tests/spec/ext_transform_feedback/nonflat-integral.c           |  5 +----
 tests/spec/gl-3.1/primitive-restart-xfb.c                      |  6 +-----
 .../clipping/mixing-clip-distance-and-clip-vertex-disallowed.c | 10 +---------
 6 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index 3fc236b..f658e5e 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -145,11 +145,7 @@ DownsampleProg::compile(int supersample_factor)
 		"}\n";
 
 	/* Compile program */
-	prog = glCreateProgram();
-	GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
-	glAttachShader(prog, vs);
-	GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
-	glAttachShader(prog, fs);
+	prog = piglit_build_simple_program_unlinked(vert, frag);
 	glBindAttribLocation(prog, 0, "pos");
 	glBindAttribLocation(prog, 1, "texCoord");
 	glLinkProgram(prog);
diff --git a/tests/spec/ext_texture_array/compressed.c b/tests/spec/ext_texture_array/compressed.c
index 7739f1e..a6edf07 100644
--- a/tests/spec/ext_texture_array/compressed.c
+++ b/tests/spec/ext_texture_array/compressed.c
@@ -243,11 +243,7 @@ piglit_init(int argc, char **argv)
 	}
 
 	/* Create the shaders */
-	prog = glCreateProgram();
-	glAttachShader(prog, piglit_compile_shader_text(GL_VERTEX_SHADER,
-							vs_text));
-	glAttachShader(prog, piglit_compile_shader_text(GL_FRAGMENT_SHADER,
-							fs_text));
+	prog = piglit_build_simple_program_unlinked(vs_text, fs_text);
 	glBindAttribLocation(prog, PIGLIT_ATTRIB_POS, "piglit_Vertex");
 	glBindAttribLocation(prog, PIGLIT_ATTRIB_TEX, "piglit_MultiTexCoord0");
 	glLinkProgram(prog);
diff --git a/tests/spec/ext_transform_feedback/change-size.c b/tests/spec/ext_transform_feedback/change-size.c
index 20bd76b..dca857a 100644
--- a/tests/spec/ext_transform_feedback/change-size.c
+++ b/tests/spec/ext_transform_feedback/change-size.c
@@ -195,7 +195,6 @@ interpret_test_case_arg(const char *arg)
 void
 piglit_init(int argc, char **argv)
 {
-	GLuint vs;
 	const char *varying_name = "output_value";
 
 	/* Parse args */
@@ -217,9 +216,7 @@ piglit_init(int argc, char **argv)
 	}
 
 	/* Create program and buffer */
-	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
-	prog = glCreateProgram();
-	glAttachShader(prog, vs);
+	prog = piglit_build_simple_program_unlinked(vstext, NULL);
 	glTransformFeedbackVaryings(prog, 1, &varying_name,
 				    GL_INTERLEAVED_ATTRIBS);
 	glLinkProgram(prog);
diff --git a/tests/spec/ext_transform_feedback/nonflat-integral.c b/tests/spec/ext_transform_feedback/nonflat-integral.c
index af4179b..bdb97f5 100644
--- a/tests/spec/ext_transform_feedback/nonflat-integral.c
+++ b/tests/spec/ext_transform_feedback/nonflat-integral.c
@@ -80,10 +80,7 @@ piglit_init(int argc, char **argv)
 	GLuint buf;
 	void *initial_data;
 	int i;
-	GLuint prog = glCreateProgram();
-	GLuint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
-	glAttachShader(prog, vs);
-	glDeleteShader(vs);
+	GLuint prog = piglit_build_simple_program_unlinked(vs_text, NULL);
 	glTransformFeedbackVaryings(prog, ARRAY_SIZE(varyings), varyings,
 				    GL_INTERLEAVED_ATTRIBS);
 	glLinkProgram(prog);
diff --git a/tests/spec/gl-3.1/primitive-restart-xfb.c b/tests/spec/gl-3.1/primitive-restart-xfb.c
index c82c926..469084d 100644
--- a/tests/spec/gl-3.1/primitive-restart-xfb.c
+++ b/tests/spec/gl-3.1/primitive-restart-xfb.c
@@ -153,7 +153,6 @@ check_xfb_result()
 void
 piglit_init(int argc, char **argv)
 {
-	GLuint vs;
 	GLuint buf;
 	void *initial_data;
 	bool pass = true;
@@ -173,10 +172,7 @@ piglit_init(int argc, char **argv)
 	else
 		print_usage_and_exit(argv[0]);
 
-	prog = glCreateProgram();
-	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
-	glAttachShader(prog, vs);
-	glDeleteShader(vs);
+	prog = piglit_build_simple_program_unlinked(vs_text, NULL);
 	glTransformFeedbackVaryings(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS);
 	glBindAttribLocation(prog, 0, "x_in");
 	glLinkProgram(prog);
diff --git a/tests/spec/glsl-1.30/linker/clipping/mixing-clip-distance-and-clip-vertex-disallowed.c b/tests/spec/glsl-1.30/linker/clipping/mixing-clip-distance-and-clip-vertex-disallowed.c
index bfe68b6..0bd5005 100644
--- a/tests/spec/glsl-1.30/linker/clipping/mixing-clip-distance-and-clip-vertex-disallowed.c
+++ b/tests/spec/glsl-1.30/linker/clipping/mixing-clip-distance-and-clip-vertex-disallowed.c
@@ -77,8 +77,6 @@ piglit_init(int argc, char **argv)
 	float glsl_version;
 	GLint ok;
 	GLuint prog;
-	GLuint vs;
-	GLuint fs;
 
 
 	piglit_require_GLSL();
@@ -94,14 +92,8 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 
-	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
-	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
-	prog = glCreateProgram();
-	glAttachShader(prog, vs);
-	glAttachShader(prog, fs);
+	prog = piglit_build_simple_program_unlinked(vert, frag);
 	glLinkProgram(prog);
-	glDeleteShader(vs);
-	glDeleteShader(fs);
 
 	ok = piglit_link_check_status_quiet(prog);
 	if (ok) {
-- 
1.8.3.4



More information about the Piglit mailing list