[Piglit] [PATCH] piglit_util: return 0 when piglit_compile_shader_text() fails

Brian Paul brianp at vmware.com
Wed May 18 10:45:05 PDT 2011


or when piglit_link_simple_program() fails.  Callers can then check
the return value to see if compiling/linking worked.
---
 tests/util/piglit-util.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index d6eebd8..b39cc42 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -344,6 +344,8 @@ piglit_compile_shader_text(GLenum target, const char *text)
 			fprintf(stderr, "Failed to compile %s shader: %s\n",
 				shader_name(target),
 				info);
+			glDeleteShader(prog);
+			prog = 0;
 		}
 		else if (0) {
 			/* Enable this to get extra compilation info.
@@ -426,7 +428,10 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)
 		glAttachShader(prog, vs);
 	glLinkProgram(prog);
 
-	piglit_link_check_status(prog);
+	if (!piglit_link_check_status(prog)) {
+		glDeleteProgram(prog);
+		prog = 0;
+	}
 
 	return prog;
 }
-- 
1.7.3.4



More information about the Piglit mailing list