OpenGL ES 2.0 / GLSL 1.0
Built-In Inputs, Outputs, and Constants
最終更新:
opengles
-
view
Shader programs use Special Variables to communicate with fixed-function parts of the pipeline.
Output Special Variables may be read back after writing. Input Special Variables are read-only.
All Special Variables have global scope.
Output Special Variables may be read back after writing. Input Special Variables are read-only.
All Special Variables have global scope.
Vertex Shader Special Variables [7.1]
Outputs:
Variable | Description | Units or coordinate system |
highp vec4 gl_Position; | transformed vertex position | clip coordinates |
mediump float gl_PointSize; | transformed point size (point rasterization only) | pixels |
Fragment Shader Special Variables [7.2]
Fragment shaders may write to gl_FragColor or to one or more elements of gl_FragData[], but not both.
The size of the gl_FragData array is given by the built-in constant gl_MaxDrawBuffers.
The size of the gl_FragData array is given by the built-in constant gl_MaxDrawBuffers.
Inputs:
Variable | Description | Units or coordinate system |
mediump vec4 gl_FragCoord; | fragment position within frame buffer | window coordinates |
bool gl_FrontFacing; | fragment belongs to a front-facing primitive | Boolean |
mediump int gl_PointCoord; | fragment position within a point (point rasterization only) | 0.0 to 1.0 for each component |
Outputs:
Variable | Description | Units or coordinate system |
mediump vec4 gl_FragColor; | fragment color | RGBA color |
mediump vec4 gl_FragData[n] | fragment color for color attachment n | RGBA color |
Built-In Constants With Minimum Values [7.4]
Built-in Constant | Minimum value |
const mediump int gl_MaxVertexAttribs | 8 |
const mediump int gl_MaxVertexUniformVectors | 128 |
const mediump int gl_MaxVaryingVectors | 8 |
const mediump int gl_MaxVertexTextureImageUnits | 0 |
const mediump int gl_MaxCombinedTextureImageUnits | 8 |
const mediump int gl_MaxTextureImageUnits | 8 |
const mediump int gl_MaxFragmentUniformVectors | 16 |
const mediump int gl_MaxDrawBuffers | 1 |
Built-In Uniform State [7.5]
Specifies depth range in window coordinates. If an implementation does not support highp precision in the fragment language, and state is listed as highp, then that state will only be available as mediump in the fragment language.
- struct gl_DepthRangeParameters {
- highp float near; // n
- highp float far; // f
- highp float diff; // f - n
- };
- uniform gl_DepthRangeParameters gl_DepthRange;
-