File: constant-matrix.wgsl

package info (click to toggle)
webkit2gtk 2.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 429,764 kB
  • sloc: cpp: 3,697,587; javascript: 194,444; ansic: 169,997; python: 46,499; asm: 19,295; ruby: 18,528; perl: 16,602; xml: 4,650; yacc: 2,360; sh: 2,098; java: 1,993; lex: 1,327; pascal: 366; makefile: 298
file content (61 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (9)
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
// RUN: %metal-compile main
// RUN: %metal main 2>&1 | %check


@compute @workgroup_size(1)
fn main()
{
    // CHECK-L: 8680
    let x = determinant(mat4x4(
      15,2,34,4,
      18,2,3,4,
      1,72,32,4,
      17,2,3,4,
    ));

    // CHECK-L: 8680
    let y = determinant(mat4x4(
        vec4(15,2,34,4),
        vec4(18,2,3,4),
        vec4(1,72,32,4),
        vec4(17,2,3,4),
    ));

    const m2 = mat2x2(
      1,2,
      3,4,
    );

    // CHECK-L: 1., 3., 2., 4.
    let tm2 = transpose(m2);

    // CHECK-L: 1., 4., 7., 2., 5., 8., 3., 6., 9.
    let tm3 = transpose(mat3x3(
      1,2,3,
      4,5,6,
      7,8,9,
    ));

    // CHECK-L: 2., 4., 6., 8.
    let x0 = m2 * 2;

    const m2x3 = mat2x3(
      1,2,3,
      4,5,6
    );

    // CHECK-L: 1., 4., 2., 5., 3., 6.
    let x1 = transpose(m2x3);

    // CHECK-L: 10., 14., 18.
    let x2 = m2x3 * vec2(2);

    // CHECK-L: 12., 30.
    let x3 = vec3(2) * m2x3;

    // CHECK-L: 32
    let x4 = dot(vec3(1,2,3), vec3(4,5,6));

    // CHECK-L: 95., 128., 68., 92., 41., 56., 14., 20.
    let x5 = mat3x2(1,2,3,4,5,6) * mat4x3(12,11,10,9,8,7,6,5,4,3,2,1);
}