Search code examples
iphoneopengl-esglsl

What is the precision of highp floats in GLSL ES 2.0 (for iPhone/iPod touch/iPad)?


I have a shader that ideally needs 28 bits of mantissa, though I can use less and degrade performance. How can I determine what the precision of 'highp' is in OpenGL ES? It's probably an FP24, with 16bits mantissa, but I cannot figure out for sure or how to ask OpenGL. Any ideas?


Solution

  • You want GetShaderPrecisionFormat to query the range and precision of of shader types

    int range[2], precision;
    glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, range, &precision);
    

    will give you the range and precision of highp float.