[Piglit] [PATCH 2/3] shader_runner: Add INT support in require section

Ilia Mirkin imirkin at alum.mit.edu
Wed Feb 18 15:03:36 PST 2015


On Wed, Feb 18, 2015 at 5:32 PM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> This allows a shader_test to require something like:
> INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  tests/shaders/shader_runner.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index c193de9..e9a56ff 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -566,7 +566,36 @@ process_requirement(const char *line)
>          * can also require that a particular extension not be supported by
>          * prepending ! to the extension name.
>          */
> -       if (string_match("GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", line)) {
> +       if (string_match("INT ", line)) {
> +               enum comparison cmp;
> +               const char *enum_name = eat_whitespace(line+3);
> +               const char *int_string;
> +               int comparison_value, gl_int_value;
> +               GLenum int_enum;
> +
> +               strcpy_to_space(buffer, enum_name);
> +
> +               int_enum = piglit_get_gl_enum_from_name(buffer);
> +
> +               int_string = process_comparison(eat_whitespace(enum_name + strlen(buffer)), &cmp);
> +               comparison_value = atoi(int_string);
> +
> +               glGetIntegerv(int_enum, &gl_int_value);
> +               if (!piglit_check_gl_error(GL_NO_ERROR)) {
> +                       fprintf(stderr, "Error reading %s\n", buffer);
> +                       piglit_report_result(PIGLIT_FAIL);

Hmmm... the theory being that you should write the shader test s.t.
the extension that enables the enum is written beforehand, and so if
the enum's not there at all, that's a fail? I _guess_... Perhaps
others have thoughts on this?

> +               }
> +
> +               if (!compare(comparison_value, gl_int_value, cmp)) {
> +                       printf("Test requires %s %s %i.  "
> +                              "The driver supports %i.\n",
> +                              buffer,
> +                              comparison_string(cmp),
> +                              comparison_value,
> +                              gl_int_value);
> +                       piglit_report_result(PIGLIT_SKIP);
> +               }
> +       } else if (string_match("GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", line)) {
>                 enum comparison cmp;
>                 int maxcomp;
>
> --
> 2.1.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list