glGetShaderPrecisionFormat — return the range and precision for different shader numeric formats
void glGetShaderPrecisionFormat( | GLenum shaderType, |
| GLenum precisionType, | |
| GLint *range, | |
GLint *precision); |
shaderTypeSpecifies the type of shader to query. Must be either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
precisionTypeSpecifies 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.
rangeSpecifies a pointer to the two-element array in which the of the minimum and maximum representable magnitudes of the format are returned.
precisionSpecifies a pointer to the location in which the of the precision of the format is returned.
glGetShaderPrecisionFormat returns range and precision limits for floating-point and integer shader variable formats with low, medium, and high precision qualifiers. When and are the minimum and maximum representable values of the format, and are returned in range as the first and second elements, respectively.
If the smallest representable value greater than 1 is then 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.
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.
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.
Copyright © 2008 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.