[Piglit] [PATCH 1/9] piglit util: new functions piglit_program_pipeline_check_status/quiet
Ian Romanick
idr at freedesktop.org
Wed Sep 4 12:57:40 PDT 2013
From: Gregory Hainaut <gregory.hainaut at gmail.com>
Equivalent to piglit_link_check_status/quiet but with program object pipeline
V4: move function in piglit-shader-gl.c (not supported on GLES*)
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/util/piglit-shader-gl.c | 51 ++++++++++++++++++++++++++++++++++++++++
tests/util/piglit-shader-gles1.c | 6 +++++
tests/util/piglit-shader-gles2.c | 2 ++
tests/util/piglit-shader.h | 3 +++
4 files changed, 62 insertions(+)
diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
index 32a7c45..adfe496 100644
--- a/tests/util/piglit-shader-gl.c
+++ b/tests/util/piglit-shader-gl.c
@@ -80,3 +80,54 @@ piglit_require_fragment_shader(void)
piglit_report_result(PIGLIT_SKIP);
}
}
+
+/* Same function as link_check_status 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_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);
+}
diff --git a/tests/util/piglit-shader-gles1.c b/tests/util/piglit-shader-gles1.c
index 4902ba9..5d1c5b0 100644
--- a/tests/util/piglit-shader-gles1.c
+++ b/tests/util/piglit-shader-gles1.c
@@ -47,3 +47,9 @@ piglit_require_fragment_shader(void)
printf("GLES1 lacks GLSL\n");
piglit_report_result(PIGLIT_SKIP);
}
+
+GLboolean
+piglit_program_pipeline_check_status(GLuint pipeline) {}
+
+GLboolean
+piglit_program_pipeline_check_status_quiet(GLuint pipeline) {}
diff --git a/tests/util/piglit-shader-gles2.c b/tests/util/piglit-shader-gles2.c
index 09ed61f..85c7699 100644
--- a/tests/util/piglit-shader-gles2.c
+++ b/tests/util/piglit-shader-gles2.c
@@ -26,3 +26,5 @@
void piglit_require_GLSL(void) {}
void piglit_require_vertex_shader(void) {}
void piglit_require_fragment_shader(void) {}
+GLboolean piglit_program_pipeline_check_status(GLuint pipeline) {}
+GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline) {}
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 8f18f0a..0f26f80 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -39,6 +39,9 @@ GLint piglit_build_simple_program(const char *vs_source, const char *fs_source);
GLuint piglit_build_simple_program_unlinked(const char *vs_source,
const char *fs_source);
+extern GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
+extern GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline);
+
#if defined(PIGLIT_USE_OPENGL_ES1)
#define glAttachShader assert(!"glAttachShader does not exist in ES1")
#define glBindAttribLocation assert(!"glBindAttribLocation does not exist in ES1")
--
1.8.1.4
More information about the Piglit
mailing list