1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/* The ARB_shading_language_420pack suggests:
*
* Verify that the following two arrays are identical:
*
* vec4 a[12] = vec4 [] (vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0),
* vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4),
* vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0));
* vec4 b[12] = { vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0),
* vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4) }; [sic]
*
* Of course, it means to include a final row of four vec4(0.0) in the initializer
* of b[12].
*
* This test differs from aggregate-initializer-sized-array.shader_test in that
* it specifies one dynamic variable, to further test the compiler. Otherwise,
* the initializer is constant folded away. The arrays should still be identical.
*/
[require]
GLSL >= 1.30
GL_ARB_shading_language_420pack
[vertex shader]
#extension GL_ARB_shading_language_420pack: enable
in vec4 vertex;
out vec4 color;
void main()
{
vec4 a[12] = vec4 [] (vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0),
vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4),
vec4(vertex.x), vec4(0.0), vec4(0.0), vec4(0.0));
vec4 b[12] = { vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0),
vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4),
vec4(vertex.x), vec4(0.0), vec4(0.0), vec4(0.0) };
color = vec4(0.0, 1.0, 0.0, 1.0);
if (a.length() != b.length()) {
color = vec4(0.0, 0.0, 1.0, 1.0);
} else {
for (int i = 0; i < a.length(); i++) {
if (a[i] != b[i]) {
color = vec4(1.0, 0.0, 0.0, 1.0);
}
}
}
gl_Position = vertex;
}
[fragment shader]
in vec4 color;
out vec4 frag_color;
void main() {
frag_color = color;
}
[test]
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
|