Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Use highp precision in the gles2 fragment shader if available #29014
This fixes #28199.
The problem was, that the custom shader code (uniforms starting with m_; added via ShaderCompilerGLES2) did not have explicit precision types set, so the default ones for the fragmant shader (mediump) were used while the vertex used highp.
See the specs (4.5.3 Default Precision Qualifiers):
This fix uses highp for the fragment shader by default (if available).
We discussed this on IRC, and reduz is concerned about the performance impact on mobile if we default to high precision always. The issue with this fix is that all calculations in fragment shaders are going to use highp by default. Most users don't specify precision for each variable, so everyone's projects will take a big performance hit (on mobile the speed difference between highp and mediump can be huge).
While this does correctly fix the bug, I think a better fix can be found. We need to make it so that all uniforms are specified highp by default, but all others are not (they would use default value). This will likely take some tinkering in https://github.com/godotengine/godot/blob/master/drivers/gles2/shader_gles2.cpp
Reduz on IRC:
Let me know if you have any questions/need any help!