Search code examples
opengl-esglslopengl-es-3.1

what is the maximum integer(unsigned integer) value that glsl can support?


What's the maximum value of integer and unsigned integer that can be used in shader?


Solution

  • For OpenGL ES 3.x "lowp int" must be at least 9-bit twos complement, "mediump int" must be at least 16-bit twos complement, and "highp int" must be at least 32-bit twos complement.

    Precision Signed range Unsigned range
    lowp -28 to 28-1 0 to 29-1
    mediump -215 to 215-1 0 to 216-1
    highp -231 to 231-1 0 to 232-1

    Reference: Section 4.5.1 Range and Precision (page 53 in the PDF).

    https://www.khronos.org/registry/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf