When writing code for a fragment shader, it starts as follows:
#ifdef GL_ES precision mediump float; #endif
Why does the “precision mediump float;” line have to depend on whether GL_ES was defined or not?
It doesn’t "have to"; it simply does.
Desktop GL will ignore any
precision declarations. So there’s no need to
ifdef around it.
That being said, if one wants to share GLSL code with very old versions of desktop GLSL (1.20 or before), then the
#ifdef is useful, as such versions did not allow the