series Reviewed-by: Mark Janes <[email protected]>

Matt Turner <[email protected]> writes:

> By flattening the if statements we cut 288 instructions from the
> fragment shader (806 -> 518, or 35%), and we remove all register
> spilling on i965.
>
> Reduces runtime of "varying-packing-simple int separate" by
> -81.4453% +/- 0.255875% (n=483).
>
> Also consistently print 3 digits in the varying's names, to make
> reading/sorting simpler.
> ---
>  tests/spec/glsl-1.10/execution/varying-packing/simple.c | 17 
> +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/tests/spec/glsl-1.10/execution/varying-packing/simple.c 
> b/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> index 618f325..e9935c7 100644
> --- a/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> +++ b/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> @@ -258,12 +258,12 @@ get_shader(bool is_vs, unsigned glsl_version, int 
> num_varyings,
>               if (varyings[i].type->base != BASE_TYPE_FLOAT)
>                       opt_flat_keyword = "flat ";
>               if (varyings[i].array_elems != 0) {
> -                     text += sprintf(text, "%s%s %s var%u[%u];\n",
> +                     text += sprintf(text, "%s%s %s var%03u[%u];\n",
>                                       opt_flat_keyword, varying_keyword,
>                                       varyings[i].type->name, i,
>                                       varyings[i].array_elems);
>               } else {
> -                     text += sprintf(text, "%s%s %s var%u;\n",
> +                     text += sprintf(text, "%s%s %s var%03u;\n",
>                                       opt_flat_keyword, varying_keyword,
>                                       varyings[i].type->name, i);
>               }
> @@ -292,8 +292,8 @@ get_shader(bool is_vs, unsigned glsl_version, int 
> num_varyings,
>                               for (l = 0; l < varyings[i].type->num_rows; 
> ++l) {
>                                       text += sprintf(text, "  ");
>                                       if (!is_vs)
> -                                             text += sprintf(text, "if (");
> -                                     text += sprintf(text, "var%u", i);
> +                                             text += sprintf(text, "failed = 
> failed || ");
> +                                     text += sprintf(text, "var%03u", i);
>                                       if (varyings[i].array_elems)
>                                               text += sprintf(text, "[%u]", 
> j);
>                                       if (varyings[i].type->num_cols > 1)
> @@ -304,16 +304,9 @@ get_shader(bool is_vs, unsigned glsl_version, int 
> num_varyings,
>                                               text += sprintf(text, " = ");
>                                       else
>                                               text += sprintf(text, " != ");
> -                                     text += sprintf(text, "%s(i + %u)",
> +                                     text += sprintf(text, "%s(i + %u);\n",
>                                                       base_type_name,
>                                                       offset++);
> -                                     if (is_vs) {
> -                                             text += sprintf(text, ";\n");
> -                                     } else {
> -                                             text += sprintf(text,
> -                                                             ")\n"
> -                                                             "    failed = 
> true;\n");
> -                                     }
>                               }
>                       }
>               }
> -- 
> 2.0.5
_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to