Light | Dark

glGetShaderPrecisionFormat

Name

glGetShaderPrecisionFormat — return the range and precision for different shader numeric formats

C Specification

void glGetShaderPrecisionFormat(GLenum shaderType,
GLenum precisionType,
GLint *range,
GLint *precision);

Parameters

shaderType

Specifies the type of shader to query. Must be either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.

precisionType

Specifies the numeric format to query, corresponding to a shader precision qualifier and variable type. Must be one of GL_LOW_FLOAT, GL_MEDIUM_FLOAT, GL_HIGH_FLOAT, GL_LOW_INT, GL_MEDIUM_INT, or GL_HIGH_INT.

range

Specifies a pointer to the two-element array in which the log 2 of the minimum and maximum representable magnitudes of the format are returned.

precision

Specifies a pointer to the location in which the log 2 of the precision of the format is returned.

Description

glGetShaderPrecisionFormat returns range and precision limits for floating-point and integer shader variable formats with low, medium, and high precision qualifiers. When minRep and maxRep are the minimum and maximum representable values of the format, floor log 2 minRep and floor log 2 maxRep are returned in range as the first and second elements, respectively.

If the smallest representable value greater than 1 is 1 + then floor - log 2 is returned in precision. An integer format will have an ∊ of 1, and thus will return 0. Floating-point formats will return values greater than 0.

Notes

The minimum range and precision required for different formats is described in the OpenGL ES Shading Language Specification.

If a high precision floating-point format is not supported for fragment shaders, calling glGetShaderPrecisionFormat with arguments GL_FRAGMENT_SHADER and GL_HIGH_FLOAT will return 0 for both range and precision. Support for a high precision floating-point format is mandatory for vertex shaders.

Shader compiler support is optional, and thus must be queried before use by calling glGet with argument GL_SHADER_COMPILER. glShaderSource, glCompileShader, glGetShaderPrecisionFormat, and glReleaseShaderCompiler will each generate GL_INVALID_OPERATION on implementations that do not support a shader compiler. Such implementations instead offer the glShaderBinary alternative for supplying a pre-compiled shader binary.

If an error is generated, no change is made to the contents of range or precision.

Errors

GL_INVALID_OPERATION is generated if a shader compiler is not supported.

GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value.

Associated Gets

glGet with argument GL_SHADER_COMPILER

Think you can improve this page? Edit this page on GitHub.