MENU
Qualifiers
| Storage Qualifiers | |
| (none) | local read/write; input parameter |
| const | compile-time constant; read-only function parameter; must be initialized during declaration |
| attribute | used to pass per-vertex data to the vertex shader; must be global; can only be used with float, vec2, vec3, vec4, mat2, mat3, and mat4 |
| uniform | used to pass data to the vertex and fragment shaders; read-only; value does not change across the primitive being drawn |
| varying | used to pass data from the vertex shader to the fragment shader; must be global; can only be used with float, vec2, vec3, vec4, mat2, mat3, and mat4. The value passed to a fragment shader is interpolated across the vertices according to the shape drawn. |
| Precision Qualifiers | |
| (none) | Vertex Shader (default): int: highp float: highp sampler2D: lowp samplerCube: lowp Fragment Shader (default): int: mediump float: None sampler2D: lowp samplerCube: lowp |
| highp | float range: (-262,262) float precision: 2-16 int range: (-216,216) |
| mediump | float range: (-214,214) float precision: 2-10 int range: (-210,210) |
| lowp | float range: (-2,2) float precision: 2-8 int range: (-28 ,28) |
| Function Parameter Qualifiers | |
| (none) | same as 'in' |
| in | passes values in as function parameters; values not passed out during return time |
| out | passes values out of functions during return time; values not initialized when the variables are passed in |
| inout | passes values both in and out of functions |
| Examples ([storage][parameter][precision]<type><var>) |
|
| varying lowp vec2 v; | |
| precision mediump float; //all floats are mediump precision highp int; // all ints are highp // ivec4 now has 4 highp int components |
|
| void luma(const in vec3 color, out float brightness){ brightness=0.2*color.r +0.7*color.g+0.7*color.b; } |
|