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

gonzojive picture gonzojive · Dec 10, 2010 · Viewed 30.9k times · Source

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?

Answer

Brad Larson picture Brad Larson · Dec 13, 2010

From the OpenGL ES Shading Language reference:

  • highp - 16-bit, floating point range: -2^62 to 2^62, integer range: -2^16 to 2^16
  • mediump - 10 bit, floating point range: -2^14 to 2^14, integer range: -2^10 to 2^10
  • lowp - 8 bit, floating point range: -2 to 2, integer range: -2^8 to 2^8