Imagination PowerVR SDK Blog

[Bug] [GLSL] [iPhone SE] vec literals as statements give shader compile error


#1

The fragment shader file, reproduction steps and platform info are available here:
https://github.com/mc-imperial/shader-compiler-bugs/issues/38

The bug can be triggered from Safari via WebGL (see above link).

The following fragment shader fails to compile.

[scode lang=“glsl”]
#version 100

#ifdef GL_ES
precision mediump float;
#endif

void main()
{
vec2(1.0, 1.0);
vec3(1.0, 1.0, 1.0);
vec4(1.0, 1.0, 1.0, 1.0);
}
[/scode]

Compile error:

[scode lang=“text”]
Failed to compile fragment shader.
ERROR: 0:2: Expression of type ‘vec2’ - precision can not be inferred and no default precision available
ERROR: 0:3: Expression of type ‘vec3’ - precision can not be inferred and no default precision available
ERROR: 0:4: Expression of type ‘vec4’ - precision can not be inferred and no default precision available
[/scode]

The shader is valid according to glslangValidator.