[Piglit] [PATCH] Add test for accessing a varying array with a large negative offset

Ilia Mirkin imirkin at alum.mit.edu
Tue Mar 24 09:50:28 PDT 2015


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Tue, Mar 24, 2015 at 11:25 AM, Tom Stellard <thomas.stellard at amd.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This tests for a bug causing either a crash or a mis-compile in the
> radeonsi compiler.
>
> Tom Stellard:
>   - Decrease the offset to guarantee we hit the bug.
> ---
>  ...rying-array-float-negative-index-rd.shader_test | 77 ++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>  create mode 100644 tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
>
> diff --git a/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
> new file mode 100644
> index 0000000..3f8926f
> --- /dev/null
> +++ b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
> @@ -0,0 +1,77 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +varying float m1[4];
> +varying float m2[4];
> +
> +void main()
> +{
> +    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
> +
> +    m1[0] = 1.0;
> +    m1[1] = 2.0;
> +    m1[2] = 3.0;
> +    m1[3] = 4.0;
> +    m2[0] = 5.0;
> +    m2[1] = 6.0;
> +    m2[2] = 7.0;
> +    m2[3] = 8.0;
> +}
> +
> +[fragment shader]
> +uniform int index;
> +uniform float expect;
> +varying float m1[4];
> +varying float m2[4];
> +
> +void main()
> +{
> +    gl_FragColor = ((index >= 512 ? m2[index-512] : m1[index]) == expect)
> +        ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +ortho
> +
> +uniform int index 0
> +uniform float expect 1
> +draw rect 5 5 10 10
> +probe rgb 10 10 0.0 1.0 0.0
> +
> +uniform int index 1
> +uniform float expect 2
> +draw rect 30 5 10 10
> +probe rgb 35 10 0.0 1.0 0.0
> +
> +uniform int index 2
> +uniform float expect 3
> +draw rect 55 5 10 10
> +probe rgb 60 10 0.0 1.0 0.0
> +
> +uniform int index 3
> +uniform float expect 4
> +draw rect 80 5 10 10
> +probe rgb 85 10 0.0 1.0 0.0
> +
> +uniform int index 512
> +uniform float expect 5
> +draw rect 105 5 10 10
> +probe rgb 110 10 0.0 1.0 0.0
> +
> +uniform int index 513
> +uniform float expect 6
> +draw rect 130 5 10 10
> +probe rgb 135 10 0.0 1.0 0.0
> +
> +uniform int index 514
> +uniform float expect 7
> +draw rect 155 5 10 10
> +probe rgb 160 10 0.0 1.0 0.0
> +
> +uniform int index 515
> +uniform float expect 8
> +draw rect 180 5 10 10
> +probe rgb 185 10 0.0 1.0 0.0
> --
> 2.0.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list