summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-27 12:18:47 +0200
committerGitHub <noreply@github.com>2019-05-27 12:18:47 +0200
commitb9ee3f3d64365611499c23ab8b57006bf04a1107 (patch)
tree0c05d486579cef91b2f8befce16527308790e3fe /drivers/gles2
parent6f49fc27f8eb9c3adfb46769cdcbc2d4ed529b6f (diff)
parent502dbc7c4a666ce845db6fff160b6ff59e956f4e (diff)
Merge pull request #29014 from mbrlabs/gles2_precision_fix
Use highp precision in the gles2 fragment shader if available
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 6ba4004f20..9778d39a21 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -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());