1[require]
2GLSL >= 1.30
3GL_ARB_uniform_buffer_object
4
5[vertex shader]
6#extension GL_ARB_uniform_buffer_object: require
7
8/* Setting the COLUMN_MAJOR define will cause the test to pass.  The problem
9 * appears to be that the i965 backend generates the load of s[1].bv2.x from
10 * offset 80 even when m41_1 is row-major.  When m41_1 is row-major,
11 * s[1].bv2.x should be at offset 64.  This is correctly reported via the GL
12 * API.
13 */
14//#define COLUMN_MAJOR
15
16struct S {
17    bvec2       bv2;
18    mat4x2      m42_1;
19};
20
21layout(std140
22#ifndef COLUMN_MAJOR
23       , row_major
24#endif
25      ) uniform UB1 {
26    S[2] s;
27};
28
29flat out int vertex_pass;
30in vec4 piglit_vertex;
31
32void main()
33{
34    vertex_pass = int(s[1].bv2.x);
35    gl_Position = piglit_vertex;
36}
37
38[fragment shader]
39out vec4 piglit_fragcolor;
40flat in int vertex_pass;
41
42void main()
43{
44    piglit_fragcolor = vec4(1 - vertex_pass, vertex_pass, 0, 1);
45}
46
47[test]
48active uniform s[1].m42_1 GL_UNIFORM_OFFSET 64
49active uniform s[1].m42_1 GL_UNIFORM_IS_ROW_MAJOR 1
50
51uniform ivec2 s[1].bv2 1 0
52
53draw rect -1 -1 2 2
54probe all rgba 0.0 1.0 0.0 1.0
55