This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there practical examples of Half-float (FP16) ?

Greetings,

After reading“PHENOMENAL COSMIC POWERS! Itty-bitty living space!” from edplowman, I'm wondering how the FP16 type can actually be used ?

When reading the ARMv7 and ARMv8 architectures manuals, the only instructions that I found to refer to half-precision floating-points are VCVT (ARMv7) or FCVT (ARMv8).

So, my questions are :

  • Can CPU do anything with half-precision floating points beside converting them ? Can you add/subtract/multiply/divide half-precision floating-points natively ?
  • How do you use half-precision floating points values efficiently with OpenGL ? Do you do all the operations with single-precision floats and do a conversion before sending the data to the GPU ?
  • Is there any example showing how to use this data type efficiently ?
Parents
  • Does it affect automatic filtering (GL_SAMPLES, GL_LINEAR_MIPMAP_LINEAR, Anisotropic extensions) or only hand-written filtering algorithms ?

    It will affect everything; it's just a problem with quantization causing less accurate sample points with higher floating point values (as the exponent gets bigger you get fewer and fewer decimal places).

    I mean, can the visual quality of some applied textures be improved by just setting precision highp float; instead of precision mediump float; in the fragment shader and sending fp32 coordinates ?

    Potentially yes; it depends how the texture is being used (do you have UV wrapping), and on the size of the texture (bigger texture = more pixels to cover with the same 0-1 number range, so effectively less bits per pixel). The driver can help automatically here (we know what inputs are used as texture coordinates), so we can prevent the worst of the issues without the application changing anything.

Reply
  • Does it affect automatic filtering (GL_SAMPLES, GL_LINEAR_MIPMAP_LINEAR, Anisotropic extensions) or only hand-written filtering algorithms ?

    It will affect everything; it's just a problem with quantization causing less accurate sample points with higher floating point values (as the exponent gets bigger you get fewer and fewer decimal places).

    I mean, can the visual quality of some applied textures be improved by just setting precision highp float; instead of precision mediump float; in the fragment shader and sending fp32 coordinates ?

    Potentially yes; it depends how the texture is being used (do you have UV wrapping), and on the size of the texture (bigger texture = more pixels to cover with the same 0-1 number range, so effectively less bits per pixel). The driver can help automatically here (we know what inputs are used as texture coordinates), so we can prevent the worst of the issues without the application changing anything.

Children