bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-matrix-constr-inES3.txt
2015-04-02 23:30:48 -07:00

28 lines
741 B
Text

#version 300 es
// A very cut down variant of Unity's directional lightmap;
// has an inline medium precision matrix constructor,
// but even if dirBasis is declared as mediump
// some code was promoting it to high precision.
out mediump vec4 _glesFragData;
mat3 transposem3(mat3 m) {
return mat3( m[0][0], m[1][0], m[2][0],
m[0][1], m[1][1], m[2][1],
m[0][2], m[1][2], m[2][2]);
}
in mediump vec3 inNormal;
void main()
{
mediump mat3 dirBasis = transposem3(mat3(
vec3( 0.8164966, 0.0, 0.5773503),
vec3( -0.4082483, 0.7071068, 0.5773503),
vec3( -0.4082483, -0.7071068, 0.5773503)));
mediump vec4 c;
c.xyz = dirBasis * inNormal;
c.w = 0.0;
_glesFragData = c;
}