From 8589a1b117458fbf834015044bf01ff326897cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 10 Jan 2017 17:05:09 +0100 Subject: [PATCH] Fix uniforms with the same name shadowing others Follow-up of #7344 --- drivers/gles2/shader_compiler_gles2.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index d4636ed4443..d5d44bf758b 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -571,15 +571,12 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { global_code+=uline; if (uniforms) { - //if (uniforms->has(E->key())) { - // //repeated uniform, error - // ERR_EXPLAIN("Uniform already exists from other shader: "+String(E->key())); - // ERR_FAIL_COND_V(uniforms->has(E->key()),ERR_ALREADY_EXISTS); -// -// } - SL::Uniform u = E->get(); - u.order+=ubase; - uniforms->insert(E->key(),u); + // Check to avoid uniforms with the same name being re-added to avoid overwriting entries + if (!uniforms->has(E->key())) { + SL::Uniform u = E->get(); + u.order+=ubase; + uniforms->insert(E->key(),u); + } } }