diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index aaabe78f8..6b30ca682 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -230,17 +230,18 @@ void ShaderCompilerGLES2::_dump_function_deps(const SL::ShaderNode *p_node, cons ERR_FAIL_COND(fidx == -1); - for (RBSet::Element *E = p_node->functions[fidx].uses_function.front(); E; E = E->next()) { - if (r_added.has(E->get())) { + for (int ufidx = 0; ufidx < p_node->functions[fidx].uses_function.size(); ufidx++) { + StringName function_name = p_node->functions[fidx].uses_function[ufidx]; + if (r_added.has(function_name)) { continue; } - _dump_function_deps(p_node, E->get(), p_func_code, r_to_add, r_added); + _dump_function_deps(p_node, function_name, p_func_code, r_to_add, r_added); SL::FunctionNode *fnode = nullptr; for (int i = 0; i < p_node->functions.size(); i++) { - if (p_node->functions[i].name == E->get()) { + if (p_node->functions[i].name == function_name) { fnode = p_node->functions[i].function; break; } @@ -273,9 +274,9 @@ void ShaderCompilerGLES2::_dump_function_deps(const SL::ShaderNode *p_node, cons header += ")\n"; r_to_add += header.as_string(); - r_to_add += p_func_code[E->get()]; + r_to_add += p_func_code[function_name]; - r_added.insert(E->get()); + r_added.insert(function_name); } } diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 6cb3ec2bd..546e1fe42 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -3404,7 +3404,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons //add to current function as dependency for (int j = 0; j < shader->functions.size(); j++) { if (shader->functions[j].name == current_function) { - shader->functions.write[j].uses_function.insert(name); + shader->functions.write[j].uses_function.push_back(name); break; } } diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index c0c3d10fb..b52975dc7 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -603,7 +603,7 @@ public: struct Function { StringName name; FunctionNode *function; - RBSet uses_function; + Vector uses_function; bool callable; };