File: length-matrix.shader_test

package info (click to toggle)
piglit 0~git20180515-62ef6b0db-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 102,084 kB
  • sloc: ansic: 244,201; xml: 47,485; python: 28,308; lisp: 19,320; cpp: 10,678; sh: 301; makefile: 33; pascal: 5
file content (55 lines) | stat: -rw-r--r-- 1,206 bytes parent folder | download | duplicates (4)
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
/* The ARB_shading_language_420pack spec says:
 *
 *     "The length method may be applied to matrices. The result is the number
 *      of columns of the matrix. For example,
 *
 *          mat3x4 v;
 *          const int L = v.length();
 *
 *      sets the constant L to 3. The type returned by .length() on a matrix
 *      is *int*."
 *
 * Verify that mat.length() returns the number of columns and that the type is
 * int.
 */

[require]
GLSL >= 1.30
GL_ARB_shading_language_420pack

[vertex shader passthrough]

[fragment shader]
#extension GL_ARB_shading_language_420pack: enable

out vec4 frag_color;

void main() {
    mat2x2 m2x2;
    mat2x3 m2x3;
    mat2x4 m2x4;
    mat3x2 m3x2;
    mat3x3 m3x3;
    mat3x4 m3x4;
    mat4x2 m4x2;
    mat4x3 m4x3;
    mat4x4 m4x4;

    frag_color = vec4(0.0, 1.0, 0.0, 1.0);

    if (m2x2.length() != 2 ||
        m2x3.length() != 2 ||
        m2x4.length() != 2 ||
        m3x2.length() != 3 ||
        m3x3.length() != 3 ||
        m3x4.length() != 3 ||
        m4x2.length() != 4 ||
        m4x3.length() != 4 ||
        m4x4.length() != 4) {
        frag_color = vec4(1.0, 0.0, 0.0, 1.0);
    }
}

[test]
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0