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
|
/* The ARB_shading_language_420pack says:
*
* "The *length* method may be applied to vectors (but not scalars). The
* result is the number of components in the vector. For example,
*
* vec3 v;
* const int L = v.length();
*
* sets the constant L to 3. The type returned by .length() on a vector is
* *int*."
*
* Verify that vec.length() returns the number of elements 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() {
vec2 v2;
vec3 v3;
vec4 v4;
frag_color = vec4(0.0, 1.0, 0.0, 1.0);
if (v2.length() != 2 ||
v3.length() != 3 ||
v4.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
|