glsl-array-bounds: set out-of-bounds array index inside shader
[piglit.git] / tests / shaders / glsl-array-bounds-07.shader_test
blob7bc3a0516f0c8c8d99d59650b7d517dcb2a658f5
1 [require]
2 GLSL >= 1.20
4 [vertex shader]
5 /* Verify that out-of-bounds access to an array does not result in any sort of
6  * program interruption.
7  *
8  * In this test case the array index may be constant folded.
9  */
10 #version 120
12 float array[] = float [] (1.0, 2.0, 3.0, 4.0);
14 void main()
16    int idx = -20;
18    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
20    if (array[idx] == 5.0)
21       gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
22    else
23       gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
26 [fragment shader]
27 void main()
29         gl_FragColor = gl_Color;
32 [test]
33 clear color 0.0 0.0 0.0 0.0
34 clear
35 ortho
36 draw rect 10 10 10 10
37 probe rgb 15 15 0.0 1.0 0.0