Difference between revisions of "Shader Compilation"

From OpenGL Wiki
Jump to navigation Jump to search
(Section on error handling)
Line 4: Line 4:
  
 
== Shader and program objects ==
 
== Shader and program objects ==
 +
 +
A [[Program Object]] can contain the executable code for all of the [[Shader]] stages, such that all that is needed to render is to bind one program object. Building programs that contain multiple shader stages requires a two-stage compilation process.
 +
 +
This two-stage compilation process mirror the standard compile/link setup for C and C++ source code. C/C++ text is first fed through a compiler, thus producing an object file. To get the executable code, one or more object files must be linked together.
 +
 +
With this method of program creation, shader text is first fed through a compiler, thus producing a ''shader object''. To get the executable program object, one or more shader objects must be linked together.
 +
 +
This process is done quite simply.
  
 
=== Shader error handling ===
 
=== Shader error handling ===

Revision as of 21:57, 5 March 2013

Shader Compilation is the process of text in the OpenGL Shading Language and loading it into OpenGL to be used as a Shader. OpenGL has three ways to compile shader text into useable OpenGL objects. All of these forms of compilation produce a Program Object.

Shader and program objects

A Program Object can contain the executable code for all of the Shader stages, such that all that is needed to render is to bind one program object. Building programs that contain multiple shader stages requires a two-stage compilation process.

This two-stage compilation process mirror the standard compile/link setup for C and C++ source code. C/C++ text is first fed through a compiler, thus producing an object file. To get the executable code, one or more object files must be linked together.

With this method of program creation, shader text is first fed through a compiler, thus producing a shader object. To get the executable program object, one or more shader objects must be linked together.

This process is done quite simply.

Shader error handling

Separate programs

Separate Shader Stages
Core in version 4.6
Core since version 4.1
Core ARB extension ARB_separate_shader_objects


Program pipelines

Binary upload

Program Binary
Core in version 4.6
Core since version 4.1
Core ARB extension ARB_get_program_binary


Error handling

Interface matching