Difference between revisions of "Shader"

From OpenGL.org
Jump to: navigation, search
m (Combined.)
(De-stubifying.)
Line 1: Line 1:
A ''Shader'' is a program designed to run on some stage of a graphics processor. Its purpose is to execute one of the programmable stages of the [[Rendering Pipeline Overview|rendering pipeline]].
+
A '''Shader''' is a program designed to run on some stage of a graphics processor. Its purpose is to execute one of the programmable stages of the [[Rendering Pipeline Overview|rendering pipeline]].
  
In OpenGL, shaders are written in [[GLSL]], and are of the following types:
+
== Stages ==
  
* [[Vertex Shader]]s (GL ≥ 2.0)
+
The rendering pipeline defines certain sections to be programmable. Each of these sections, or stages, represents a particular type of programmable processing. Each stage has a set of inputs and outputs, which are passed from prior stages and on to subsequent stages (whether programmable or not).
* [[Tessellation Shader|Tessellation Control and Evaluation Shader]]s (GL ≥ 4.0)
+
* [[Geometry Shader]]s (GL ≥ 3.2)
+
* [[Fragment Shader]]s (GL ≥ 2.0)
+
* [[Compute Shader]]s (GL ≥ 4.3)
+
  
{{stub}}
+
Shaders are written in the [[OpenGL Shading Language]]. The OpenGL rendering pipeline defines the following shader stages:
 +
 
 +
* [[Vertex Shader]]s
 +
* [[Tessellation Shader|Tessellation Control and Evaluation Shader]]s (requires GL 4.0 or {{extref|tessellation_shader}})
 +
* [[Geometry Shader]]s
 +
* [[Fragment Shader]]s
 +
* [[Compute Shader]]s (requires GL 4.3 or {{extref|compute_shader}})
 +
 
 +
A [[GLSL Object|program object]] can combine multiple shader stages (built from shader objects) into a single, linked whole. A [[GLSL_Object#Program_separation|program pipeline object]] can combine programs that contain individual shader stages into a whole pipeline.
 +
 
 +
While shader stages do use the same language, each stage has a separate set of inputs and outputs, as well as [[GLSL Predefined Variables|built-in variables]]. As such, shader objects are built for a specific shader stage. So while program objects can contain multiple stages, shader objects only contain code for a single stage.
  
 
[[Category:Shaders]]
 
[[Category:Shaders]]

Revision as of 17:46, 20 October 2012

A Shader is a program designed to run on some stage of a graphics processor. Its purpose is to execute one of the programmable stages of the rendering pipeline.

Stages

The rendering pipeline defines certain sections to be programmable. Each of these sections, or stages, represents a particular type of programmable processing. Each stage has a set of inputs and outputs, which are passed from prior stages and on to subsequent stages (whether programmable or not).

Shaders are written in the OpenGL Shading Language. The OpenGL rendering pipeline defines the following shader stages:

A program object can combine multiple shader stages (built from shader objects) into a single, linked whole. A program pipeline object can combine programs that contain individual shader stages into a whole pipeline.

While shader stages do use the same language, each stage has a separate set of inputs and outputs, as well as built-in variables. As such, shader objects are built for a specific shader stage. So while program objects can contain multiple stages, shader objects only contain code for a single stage.