[Piglit] [PATCH 1/3] piglit: add piglit_get_prim_name() helper
Jose Fonseca
jfonseca at vmware.com
Thu Feb 21 09:17:08 PST 2013
Looks great. Thanks Brian.
Jose
----- Original Message -----
> ---
> tests/util/piglit-util-gl-common.h | 12 ++++++++++
> tests/util/piglit-util-gl-enum.c | 41
> ++++++++++++++++++++++++++++++++++++
> 2 files changed, 53 insertions(+), 0 deletions(-)
>
> diff --git a/tests/util/piglit-util-gl-common.h
> b/tests/util/piglit-util-gl-common.h
> index 336953d..accf1f3 100644
> --- a/tests/util/piglit-util-gl-common.h
> +++ b/tests/util/piglit-util-gl-common.h
> @@ -80,6 +80,18 @@ const char* piglit_get_gl_error_name(GLenum error);
> const char *piglit_get_gl_enum_name(GLenum param);
>
> /**
> + * \brief Convert a GL primitive type enum value to a string.
> + *
> + * For example, given GL_POLYGON, return "GL_POLYGON".
> + * We don't use piglit_get_gl_enum_name() for this because there are
> + * other enums which alias the prim type enums (ex: GL_POINTS = GL_NONE);
> + *
> + * Return "(unrecognized enum)" if the enum is not recognized.
> + */
> +const char *piglit_get_prim_name(GLenum prim);
> +
> +
> +/**
> * \brief Check for unexpected GL errors.
> *
> * If glGetError() returns an error other than \c expected_error, then
> diff --git a/tests/util/piglit-util-gl-enum.c
> b/tests/util/piglit-util-gl-enum.c
> index bc48384..8769f4d 100644
> --- a/tests/util/piglit-util-gl-enum.c
> +++ b/tests/util/piglit-util-gl-enum.c
> @@ -2986,3 +2986,44 @@ piglit_get_gl_enum_name(GLenum param)
> #undef CASE
> }
>
> +
> +const char *
> +piglit_get_prim_name(GLenum prim)
> +{
> + switch (prim) {
> + case GL_POINTS:
> + return "GL_POINTS";
> + case GL_LINES:
> + return "GL_LINES";
> + case GL_LINE_STRIP:
> + return "GL_LINE_STRIP";
> + case GL_LINE_LOOP:
> + return "GL_LINE_LOOP";
> + case GL_TRIANGLES:
> + return "GL_TRIANGLES";
> + case GL_TRIANGLE_STRIP:
> + return "GL_TRIANGLE_STRIP";
> + case GL_TRIANGLE_FAN:
> + return "GL_TRIANGLE_FAN";
> + case GL_QUADS:
> + return "GL_QUADS";
> + case GL_QUAD_STRIP:
> + return "GL_QUAD_STRIP";
> + case GL_POLYGON:
> + return "GL_POLYGON";
> + case GL_LINES_ADJACENCY:
> + return "GL_LINES_ADJACENCY";
> + case GL_LINE_STRIP_ADJACENCY:
> + return "GL_LINE_STRIP_ADJACENCY";
> + case GL_TRIANGLES_ADJACENCY:
> + return "GL_TRIANGLES_ADJACENCY";
> + case GL_TRIANGLE_STRIP_ADJACENCY:
> + return "GL_TRIANGLE_STRIP_ADJACENCY";
> + case GL_PATCHES:
> + return "GL_PATCHES";
> + default:
> + return "(unrecognized enum)";
> + }
> +}
> +
> +
> --
> 1.7.3.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
More information about the Piglit
mailing list