aboutsummaryrefslogtreecommitdiff
path: root/tests/spec/glsl-es-1.00/execution/1.20/fs-outerProduct-mat4-ivec.shader_test
blob: 4fcc7dfc9bf8d8de65bf70b1b04524203888b37f (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
[require]
GLSL >= 1.00 es
GL >= 2.0 es

[vertex shader]
attribute vec4 vertex;
mat4 proj = 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);

void main() { gl_Position = vertex;
	gl_Position *= proj; }

[fragment shader]
/* From page 43 (page 49 of the PDF) of the GLSL 1.20 spec:
 *
 *     "If an exact match is found, the other signatures are ignored, and the
 *     exact match is used. Otherwise, if no exact match is found, then the
 *     implicit conversions in Section 4.1.10 "Implicit Conversions" will be
 *     applied to the calling arguments if this can make their types match a
 *     signature."
 *
 * From page 20 (page 26 of the PDF) of the GLSL 1.20 spec:
 *
 *     "In some situations, an expression and its type will be implicitly
 *     converted to a different type. The following table shows all allowed
 *     implicit conversions:
 *
 *         Type of expression    Can be implicitly converted to
 *               int                         float
 *              ivec2                         vec2
 *              ivec3                         vec3
 *              ivec4                         vec4"
 */

uniform ivec4 c;
uniform ivec4 r;
uniform mat4 expected;

void main() {
  mat4 result = outerProduct(c, r);
  gl_FragColor = (result == expected) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
}

[test]
clear color 0.5 0.5 0.5 0.0
clear


uniform ivec4 c  2 3 4 5
uniform ivec4 r  6 7 8 9
uniform mat4x4 expected  12 18 24 30 14 21 28 35 16 24 32 40 18 27 36 45
draw rect 10 10 10 10
probe rgb 15 15 0.0 1.0 0.0

uniform ivec4 c  3 4 5 6
uniform ivec4 r  7 8 9 10
uniform mat4x4 expected  21 28 35 42 24 32 40 48 27 36 45 54 30 40 50 60
draw rect 30 10 10 10
probe rgb 35 15 0.0 1.0 0.0

uniform ivec4 c  4 5 6 7
uniform ivec4 r  8 9 10 11
uniform mat4x4 expected  32 40 48 56 36 45 54 63 40 50 60 70 44 55 66 77
draw rect 50 10 10 10
probe rgb 55 15 0.0 1.0 0.0

uniform ivec4 c  5 6 7 8
uniform ivec4 r  9 10 11 12
uniform mat4x4 expected  45 54 63 72 50 60 70 80 55 66 77 88 60 72 84 96
draw rect 70 10 10 10
probe rgb 75 15 0.0 1.0 0.0