- July 4, 2011 at 3:44 pm #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, gzpJuly 4, 2011 at 5:59 pm #34974
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.July 5, 2011 at 11:43 am #34975
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
As the example was for uniforms, I thought this section still belongs to the example.
I should have read the whole section more carefully.