Graphics Reference
In-Depth Information
Fragment Shader
The fragment shader implements a general-purpose programmable
method for operating on fragments. As shown in Figure 1-4, this shader is
executed for each generated fragment by the rasterization stage and takes
the following inputs:
• Shader program—Fragment shader program source code or executable
that describes the operations that will be performed on the fragment.
• Input variables—Outputs of the vertex shader that are generated by
the rasterization unit for each fragment using interpolation.
• Uniforms—Constant data used by the fragment (or vertex) shader.
• Samplers—Specific types of uniforms that represent textures used by
the fragment shader.
The fragment shader can either discard the fragment or generate one or more
color values referred to as outputs. Typically, the fragment shader outputs just
Uniforms
Samplers
Input (Varying) 0
Input (Varying) 1
Output Color 0
Input (Varying) 2
Output Color 1
Input (Varying) 3
Fragment Shader
...
Input (Varying) 4
Output Color N
...
Input (Varying) N
gl_FragDepth
gl_FragCoord
gl_FrontFacing
gl_PointCoord
Figure 1-4
OpenGL ES 3.0 Fragment Shader
 
 
Search WWH ::




Custom Search