瀏覽代碼

Fix uniforms with the same name shadowing others
Follow-up of #7344

Pedro J. Estébanez 8 年之前
父節點
當前提交
8589a1b117
共有 1 個文件被更改,包括 6 次插入9 次删除
  1. 6 9
      drivers/gles2/shader_compiler_gles2.cpp

+ 6 - 9
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);
+			}
 		}
 	}