GL_OES_gpu_shader5#

Supported Hardware#

Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 3.10

Description#

This extension provides a set of new features to the OpenGL ES Shading Language and related APIs to support capabilities of new GPUs, extending the capabilities of version 3.10 of the OpenGL ES Shading Language. Shaders using the new functionality provided by this extension should enable this functionality via the construct:

#extension GL_OES_gpu_shader5 : require (or enable)

This extension provides a variety of new features for all shader types, including:

  • support for indexing into arrays of opaque types (samplers, and atomic counters) using dynamically uniform integer expressions;

  • support for indexing into arrays of images and shader storage blocks using only constant integral expressions;

  • extending the uniform block capability to allow shaders to index into an array of uniform blocks;

  • a “precise” qualifier allowing computations to be carried out exactly as specified in the shader source to avoid optimization-induced invariance issues (which might cause cracking in tessellation);

  • new built-in functions supporting:

  • fused floating-point multiply-add operations;

  • extending the textureGather() built-in functions provided by OpenGL ES Shading Language 3.10:

  • allowing shaders to use arbitrary offsets computed at run-time to select a 2x2 footprint to gather from; and

  • allowing shaders to use separate independent offsets for each of the four texels returned, instead of requiring a fixed 2x2 footprint.

Note#

This specification is written against the OpenGL ES 3.1 (March 17, 2014) and OpenGL ES 3.10 Shading Language (March 17, 2014) Specifications.

This extension interacts with OES_geometry_shader.

Example#

#extension GL_OES_gpu_shader5 : require
in vec4 a, b, c, d;
precise out vec4 v;
float func(float e, float f, float g, float h)
{
    return (e*f) + (g*h);            // no special precision
}
float func2(float e, float f, float g, float h)
{
    precise result = (e*f) + (g*h);  // ensures a precise return value
    return result;
}
float func3(float i, float j, precise out float k)
{
    k = i * i + j;                   // precise, due to <k> declaration
}
void main(void)
{
    vec4 r = vec3(a * b);           // precise, used to compute v.xyz
    vec4 s = vec3(c * d);           // precise, used to compute v.xyz
    v.xyz = r + s;                      // precise
    v.w = (a.w * b.w) + (c.w * d.w);    // precise
    v.x = func(a.x, b.x, c.x, d.x);     // values computed in func()
                                        // are NOT precise
    v.x = func2(a.x, b.x, c.x, d.x);    // precise!
    func3(a.x * b.x, c.x * d.x, v.x);   // precise!
}