In the learningwebgl tutorial1 I’ve found an interesting line in the fragment shader.
precision mediump float;
I’ve found an article about it here, but I still can’t understand what does it mean?
And if I remove this line, nothing changes. Everything is the same.
So what does precision mediump float mean?
This determines how much precision the GPU uses when calculating floats.
highpis high precision, and of course more intensive thanmediump(medium precision) andlowp(low precision).Some systems do not support
highpat all, which will cause code not to work at all on those systems.On systems that DO support
highp, you will see a performance hit, and should usemediumpandlowpwherever possible. A good rule of thumb that I saw was:highpfor vertex positions,mediumpfor texture coordinates,lowpfor colors.