[Piglit] [PATCH] util: Add a function to drain all GL errors.

Ian Romanick idr at freedesktop.org
Thu Dec 8 10:42:38 PST 2011


On 12/08/2011 12:29 AM, Vinson Lee wrote:
> Signed-off-by: Vinson Lee<vlee at vmware.com>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   tests/util/piglit-util.c |    7 +++++++
>   tests/util/piglit-util.h |    7 +++++++
>   2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
> index 0f7810e..d6daf32 100644
> --- a/tests/util/piglit-util.c
> +++ b/tests/util/piglit-util.c
> @@ -236,6 +236,13 @@ void piglit_check_gl_error(GLenum expected_error, enum piglit_result result)
>   	piglit_report_result(result);
>   }
>
> +void piglit_reset_gl_error(void)
> +{
> +	while (glGetError() != GL_NO_ERROR) {
> +		/* empty */
> +	}
> +}
> +
>   /* These texture coordinates should have 1 or -1 in the major axis selecting
>    * the face, and a nearly-1-or-negative-1 value in the other two coordinates
>    * which will be used to produce the s,t values used to sample that face's
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index 95aedfd..1dd6256 100755
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -163,6 +163,13 @@ const char* piglit_get_gl_error_name(GLenum error);
>    */
>   void piglit_check_gl_error(GLenum expected_error, enum piglit_result result);
>
> +/**
> + * \brief Drain all GL errors.
> + *
> + * Repeatly call glGetError and discard errors until it returns GL_NO_ERROR.
> + */
> +void piglit_reset_gl_error(void);
> +
>   int FindLine(const char *program, int position);
>   void piglit_report_result(enum piglit_result result);
>   void piglit_require_gl_version(int required_version_times_10);



More information about the Piglit mailing list