aboutsummaryrefslogtreecommitdiff
path: root/tests/spec/glsl-1.20/execution/fs-outerProduct-const-mat4x2-ivec.shader_test
blob: 900732d6802c5b438300258bf38705deb0d9b30e (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
[require]
GLSL >= 1.20
# glUniformMatrix4x2fv only exists in OpenGL 2.1 or later.
GL >= 2.1

[vertex shader]
#version 120
void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }

[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"
 */
#version 120

const ivec2 c = ivec2(2, 3);
const ivec4 r = ivec4(4, 5, 6, 7);
uniform mat4x2 expected = mat4x2(8, 12, 10, 15, 12, 18, 14, 21);

void main() {
  mat4x2 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
ortho

draw rect 10 10 10 10
probe rgb 15 15 0.0 1.0 0.0