Merge pull request #29014 from mbrlabs/gles2_precision_fix

Use highp precision in the gles2 fragment shader if available
This commit is contained in:
Rémi Verschelde 2019-05-27 12:18:47 +02:00 committed by GitHub
commit b9ee3f3d64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -316,9 +316,14 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
for (Map<StringName, SL::ShaderNode::Uniform>::Element *E = snode->uniforms.front(); E; E = E->next()) {
StringBuffer<> uniform_code;
uniform_code += "uniform ";
// use highp if no precision is specified to prevent different default values in fragment and vertex shader
SL::DataPrecision precision = E->get().precision;
if (precision == SL::PRECISION_DEFAULT) {
precision = SL::PRECISION_HIGHP;
}
uniform_code += _prestr(E->get().precision);
uniform_code += "uniform ";
uniform_code += _prestr(precision);
uniform_code += _typestr(E->get().type);
uniform_code += " ";
uniform_code += _mkid(E->key());