On Fri, Mar 27, 2015 at 12:27 AM, Tapani Pälli <tapani.pa...@intel.com> wrote:
> This test fails with current Mesa HEAD (6264348), see bug
> https://bugs.freedesktop.org/show_bug.cgi?id=84225.
>
> Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
> ---
>  .../struct-sampler-array-index.frag                | 42 
> ++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/struct-sampler-array-index.frag
>
> diff --git 
> a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/struct-sampler-array-index.frag
>  
> b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/struct-sampler-array-index.frag
> new file mode 100644
> index 0000000..122a8a4
> --- /dev/null
> +++ 
> b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/struct-sampler-array-index.frag
> @@ -0,0 +1,42 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.00
> + * [end config]
> + *
> + * From "Appendix A" of the GLSL ES 1.00 spec:
> + *
> + *     "GLSL ES 1.00 supports both arrays of samplers and arrays of
> + *      structures which contain samplers. In both these cases, for
> + *      ES 2.0, support for indexing with a constant-index-expression
> + *      is mandated"
> + *
> + * For additional complexity this test has array of structures
> + * that has array of samplers.
> + *
> + */
> +#version 100
> +
> +struct s_t
> +{
> +       sampler2D array[1];

array[2].

> +       sampler2D foo;
> +};
> +
> +uniform s_t array[1];

array[2].

> +
> +void main()
> +{
> +       highp vec4 color;
> +
> +       // case 1, sampler in array of structs
> +       for (int i = 0; i < 2; i++) {
> +               color += texture2D(array[i].foo, vec2(0.0));
> +       }
> +
> +       // case 2, index sampler array in array of structs
> +       for (int i = 0; i < 2; i++) {
> +               color += texture2D(array[i].array[i], vec2(0.0));
> +       }

I think these would be better as a doubly-nested loop. I was going to
suggest using .length() instead of hardcoded upper bounds, but that's
not really possible with two separate loops, the second of which
assumes the two arrays are of equal size.

> +
> +       gl_FragColor = color;
> +}
> --
> 2.1.0
>
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to