[Piglit] [PATCH 2/2] arb_shader_atomic_counters: recursion checks require a second paste macro

Francisco Jerez currojerez at riseup.net
Thu Jun 19 03:45:48 PDT 2014


Ilia Mirkin <imirkin at alum.mit.edu> writes:

> ---
>
> GLSL appears to defer to CPP. In CPP the intermediate macro is necessary due
> to recursion checks. e.g. if you have
>
> #define PASTE(A, B) A ## B
> #define I I
> PASTE(I, I)
>
> Then unfortunate things would happen if it auto-evaluated the macros
> repeatedly. As it is, the above would evaluate to 'II'.
>
>  tests/spec/arb_shader_atomic_counters/max-counters.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tests/spec/arb_shader_atomic_counters/max-counters.c b/tests/spec/arb_shader_atomic_counters/max-counters.c
> index 409247d..6207d22 100644
> --- a/tests/spec/arb_shader_atomic_counters/max-counters.c
> +++ b/tests/spec/arb_shader_atomic_counters/max-counters.c
> @@ -158,7 +158,8 @@ run_test_fragment_max_buffers(unsigned num_buffers)
>          char *src = atomic_counters_generate_source(
>                  "#version 140\n"
>                  "#extension GL_ARB_shader_atomic_counters : enable\n"
> -                "#define Y(I) y##I\n"
> +                "#define PASTE(A,B) A ## B\n"
> +                "#define Y(I) PASTE(y, I)\n"
>                  "\n"
>                  "out ivec4 fcolor;\n"
>                  "\n"
> @@ -190,7 +191,8 @@ run_test_vertex_max_buffers(unsigned num_buffers)
>          char *src = atomic_counters_generate_source(
>                  "#version 140\n"
>                  "#extension GL_ARB_shader_atomic_counters : enable\n"
> -                "#define X(I) x##I\n"
> +                "#define PASTE(A,B) A ## B\n"
> +                "#define X(I) PASTE(x, I)\n"
>                  "\n"
>                  "in vec4 position;\n"
>                  "flat out ivec4 vcolor;\n"
> @@ -225,7 +227,8 @@ run_test_combined_max_buffers(unsigned num_fragment_buffers,
>          char *fs_source = atomic_counters_generate_source(
>                  "#version 140\n"
>                  "#extension GL_ARB_shader_atomic_counters : enable\n"
> -                "#define Y(I) y##I\n"
> +                "#define PASTE(A,B) A ## B\n"
> +                "#define Y(I) PASTE(y, I)\n"
>                  "\n"
>                  "out ivec4 fcolor;\n"
>                  "\n"
> @@ -245,7 +248,8 @@ run_test_combined_max_buffers(unsigned num_fragment_buffers,
>          char *vs_source = atomic_counters_generate_source(
>                  "#version 140\n"
>                  "#extension GL_ARB_shader_atomic_counters : enable\n"
> -                "#define X(I) x##I\n"
> +                "#define PASTE(A,B) A ## B\n"
> +                "#define X(I) PASTE(x, I)\n"
>                  "\n"
>                  "in vec4 position;\n"
>                  "flat out ivec4 vcolor;\n"
> -- 
> 1.8.5.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Francisco Jerez <currojerez at riseup.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140619/09f45df3/attachment.sig>


More information about the Piglit mailing list