Browse Source

Shaders: `const` for readonly variables is since GLSL 4.20.

pull/23/head
Vladimír Vondruš 13 years ago
parent
commit
f166d006c2
  1. 3
      src/Shaders/MeshVisualizer.frag
  2. 4
      src/Shaders/MeshVisualizer.geom
  3. 4
      src/Shaders/Phong.frag
  4. 6
      src/Shaders/compatibility.glsl

3
src/Shaders/MeshVisualizer.frag

@ -25,6 +25,9 @@
#ifndef NEW_GLSL
#define in varying
#define fragmentColor gl_FragColor
#endif
#ifndef RUNTIME_CONST
#define const
#endif

4
src/Shaders/MeshVisualizer.geom

@ -22,6 +22,10 @@
DEALINGS IN THE SOFTWARE.
*/
#ifndef RUNTIME_CONST
#define const
#endif
layout(location = 1) uniform vec2 viewportSize;
layout(triangles) in;

4
src/Shaders/Phong.frag

@ -27,6 +27,10 @@
#define color gl_FragColor
#endif
#ifndef RUNTIME_CONST
#define const
#endif
#ifndef GL_ES
#ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 7) uniform vec3 lightColor = vec3(1.0, 1.0, 1.0);

6
src/Shaders/compatibility.glsl

@ -56,3 +56,9 @@
#define mediump
#define lowp
#endif
/* const qualifier can be used for readonly variables since GLSL 4.20, however
it's not supported even in ES 3.0 */
#if !defined(GL_ES) && __VERSION__ >= 420
#define RUNTIME_CONST
#endif

Loading…
Cancel
Save