Dynamically Uniform Expression

From OpenGL.org
Revision as of 14:42, 2 November 2012 by Alfonse (Talk | contribs) (Uses)

Jump to: navigation, search
Dynamically Uniform Expression
Core in version 4.5
Core since version 4.0

A Dynamically Uniform Expression is a GLSL expression in which all invocations of that shader within a particular rendering command will compute the same value. This concept only matters in GLSL 4.00 and above.

Definition

Examples

Uses

There are places where GLSL requires the expression to be dynamically uniform. All of the following must use a dynamically uniform expression:

  • The array index for arrays of opaque types.
  • The index to buffer-backed interface blocks.
  • In Compute Shaders, the expressions leading to the execution of a barrier()​ call. So if there is a loop or a conditional statement or somesuch, all of these conditions must be dynamically uniform expressions, so that every compute shader invocation encounters every barrier()​ statement in the same sequence and the same number of times.