missing glUniform*x from specification

This topic contains 2 replies, has 2 voices, and was last updated by  gzp 6 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #30570


    I’m tring to port a gles 1.x program to gles 2.

    Things are working quite well (matrix stack, shader generation, etc.), but I have a performance related question. The fixed point is used for calculation on the cpu. It works well for vertex attributes to upload the data in fixp16.16,  but I could not find a proper solution for the fixed-point uniform handling.  It seems, the *x functions are omitted from the gles 2 api (with respec to gles 1). So what is the proper way to upload a fixed-point number for a uniform. Converting it back to float looks strange as it will be converted to fixex-point in the gpu immediatelly (adding a completelly superflous division/multiplication pair).


    Just to summarize: what is the gles2 way to implement the glUniform3x function ?


    Thanks, gzp



    The GPU uses floats. The GLSL ES shading language has limited support for integers (basically, only integer operations that can be performed using floats are supported). The minimum required range for highp int is just (-2^16, 2^16). So using fixed point values in a shader is not that useful, and no better than using floats.

    Vertex data in GL_FIXED format gets converted to float by the hardware before being processed by the vertex shader.




    I’ve miss-interpreted the specification
    “Regardless of language binding, the enum type converts to
    fixed-point without scaling, and integer types are converted to fixed-point by multiplying
    by 2^16.”
    As the example was for uniforms, I thought this section still belongs to the example.
    I should have read the whole section more carefully.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.