Equivalent to piglit_link_check_status/quiet but with program object pipeline
V4: move function in piglit-shader-gl.c (not supported on GLES*) --- 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 33735cc..94f997a 100644 --- a/tests/util/piglit-shader-gl.c +++ b/tests/util/piglit-shader-gl.c @@ -84,3 +84,54 @@ piglit_require_fragment_shader(void) exit(1); } } + +/* 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 425eab3..25f1bbd 100644 --- a/tests/util/piglit-shader.h +++ b/tests/util/piglit-shader.h @@ -37,6 +37,9 @@ GLboolean piglit_link_check_status_quiet(GLint prog); GLint piglit_link_simple_program(GLint vs, GLint fs); GLint piglit_build_simple_program(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.7.10.4 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit