aboutsummaryrefslogtreecommitdiff
path: root/tests/spec/glsl-es-1.00/execution/variable-index-write/vs-varying-array-mat2-col-row-wr.shader_test
blob: 61e761261d295c4211761d851b2e2b92e4d8bfc9 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Test generated by:
# ../../variable-index-write.sh 1.00

[require]
GLSL ES >= 1.00
GL ES >= 2.0

[vertex shader]
attribute vec4 vertex;
mat4 projection = mat4(
    2.0/250.0, 0.0, 0.0, -1.0,
    0.0, 2.0/250.0, 0.0, -1.0,
    0.0, 0.0, -1.0, 0.0,
    0.0, 0.0, 0.0, 1.0);
uniform mat2 src_matrix;
uniform vec2 v;
uniform vec2 expect;
uniform int index;
uniform int row;
uniform int col;
uniform float value;
varying mat2 dst_matrix[3];

void main()
{
    gl_Position = vertex;
    gl_Position *= projection;

    dst_matrix[0] = mat2(0.0);
    dst_matrix[1] = mat2(0.0);
    dst_matrix[2] = mat2(0.0);

    /* Patch the supplied matrix with the supplied value.  If the resulting
     * matrix is correct, it will transform the input vector to the expected
     * value.  Verify that the distance between the result and the expected
     * vector is less than epsilon.
     *
     * NOTE: This test assumes that reads of arrays using non-constant
     * indicies works correctly.  If reads and writes happen to fail in an
     * identical manner, this test may give false positives.
     */
    dst_matrix[1] = src_matrix;
    dst_matrix[1][col][row] = value;
}

[fragment shader]
uniform mat2 src_matrix;
uniform vec2 v;
uniform vec2 expect;
uniform int index;
uniform int row;
uniform int col;
uniform float value;
varying mat2 dst_matrix[3];

void main()
{
    gl_FragColor = (distance(dst_matrix[1] * v, expect) < 1e-6)
        ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
}

[test]
clear color 0.5 0.5 0.5 0.5
clear

uniform int col 0
uniform int row 0
uniform vec2 v 0.803161418975390 0.852987140792140
uniform vec2 expect 0.708718134966688 1.452243795483797
uniform mat2x2 src_matrix 666.0 0.861223395812970 0.603473877011433 0.891622340451180
uniform float value 0.241498998195656
draw rect 45 5 10 10
probe rgb 50 10 0.0 1.0 0.0

uniform int row 1
uniform vec2 v 0.803161418975390 0.852987140792140
uniform vec2 expect 0.708718134966688 1.452243795483797
uniform mat2x2 src_matrix 0.241498998195656 666.0 0.603473877011433 0.891622340451180
uniform float value 0.861223395812970
draw rect 45 20 10 10
probe rgb 50 25 0.0 1.0 0.0

uniform int col 1
uniform int row 0
uniform vec2 v 0.803161418975390 0.852987140792140
uniform vec2 expect 0.708718134966688 1.452243795483797
uniform mat2x2 src_matrix 0.241498998195656 0.861223395812970 666.0 0.891622340451180
uniform float value 0.603473877011433
draw rect 60 5 10 10
probe rgb 65 10 0.0 1.0 0.0

uniform int row 1
uniform vec2 v 0.803161418975390 0.852987140792140
uniform vec2 expect 0.708718134966688 1.452243795483797
uniform mat2x2 src_matrix 0.241498998195656 0.861223395812970 0.603473877011433 666.0
uniform float value 0.891622340451180
draw rect 60 20 10 10
probe rgb 65 25 0.0 1.0 0.0

clear