GL_EXT_shader_io_blocks#

Supported Hardware#

Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 3.1

Description#

Typically, values passed between shader stages, such as between vertex and fragment, are passed as free, independent variables. Interface blocks add the ability to group these values together into a single packet of data, allowing structured data to flow between these stages.

The built-in output values from the vertex shader stage are redefined when this extension exists, to the following:

out gl_PerVertex {
    highp vec4  gl_Position;
    highp float gl_PointSize;
};

This has no real effect on the vertex shader but is an important distinction for other shader stages added by extensions, such as geometry and tessellation shaders.

Example#

// Vertex Shader
#extension GL_EXT_shader_io_blocks : require
layout(location = 0) out SurfaceData
{
    highp vec3 normal;
    highp vec3 tangent;
} surfaceData;
// Fragment Shader
#extension GL_EXT_shader_io_blocks : require
layout(location = 0) in SurfaceData
{
    highp vec3 normal;
    highp vec3 tangent;
} surfaceData;