[Piglit] [PATCH 1/3] piglit util: new functions piglit_program_pipeline_check_status/quiet

gregory hainaut gregory.hainaut at gmail.com
Thu Mar 28 10:31:35 PDT 2013


Equivalent to piglit_link_check_status/quiet but with program object pipeline
---
 tests/util/piglit-shader.c |   50 ++++++++++++++++++++++++++++++++++++++++++++
 tests/util/piglit-shader.h |    2 ++
 2 files changed, 52 insertions(+)

diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index c67e58a..d7a0266 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -213,6 +213,45 @@ link_check_status(GLint prog, FILE *output)
 	return ok;
 }
 
+/* Same function as above but for program pipeline */
+static GLboolean
+program_pipeline_check_status(GLuint pipeline, FILE *output)
+{
+	GLchar *info = NULL;
+	GLint size;
+	GLint ok;
+
+	piglit_require_extension("GL_ARB_separate_shader_objects");
+
+	glValidateProgramPipeline(pipeline);
+	glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
+
+	/* Some drivers return a size of 1 for an empty log.  This is the size
+	 * of a log that contains only a terminating NUL character.
+	 */
+	glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
+	if (size > 1) {
+		info = malloc(size);
+		glGetProgramPipelineInfoLog(pipeline, size, NULL, info);
+	}
+
+	if (!ok) {
+		fprintf(output, "Failed to validate the pipeline: %s\n",
+			(info != NULL) ? info : "<empty log>");
+	}
+	else if (0 && info != NULL) {
+		/* Enable this to get extra linking info.
+		 * Even if there's no link errors, the info log may
+		 * have some remarks.
+		 */
+		printf("Pipeline validataion warning: %s\n", info);
+	}
+
+	free(info);
+
+	return ok;
+}
+
 GLboolean
 piglit_link_check_status(GLint prog)
 {
@@ -234,6 +273,17 @@ piglit_link_check_status_quiet(GLint prog)
 	return link_check_status(prog, stdout);
 }
 
+GLboolean
+piglit_program_pipeline_check_status(GLuint pipeline)
+{
+	return program_pipeline_check_status(pipeline, stderr);
+}
+
+GLboolean
+piglit_program_pipeline_check_status_quiet(GLuint pipeline)
+{
+	return program_pipeline_check_status(pipeline, stdout);
+}
 
 GLint piglit_link_simple_program(GLint vs, GLint fs)
 {
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 12cf731..0bb7792 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -34,6 +34,8 @@ GLuint piglit_compile_shader(GLenum target, const char *filename);
 GLuint piglit_compile_shader_text(GLenum target, const char *text);
 GLboolean piglit_link_check_status(GLint prog);
 GLboolean piglit_link_check_status_quiet(GLint prog);
+GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
+GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline);
 GLint piglit_link_simple_program(GLint vs, GLint fs);
 
 #if defined(PIGLIT_USE_OPENGL_ES1)
-- 
1.7.10.4


More information about the Piglit mailing list