@@ -1516,16 +1516,9 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
15161516 global_code += global_expressions;
15171517
15181518 // make it faster to go around through shader
1519- VMap<ConnectionKey, const List<Connection>::Element *> input_connections;
1520- VMap<ConnectionKey, const List<Connection>::Element *> output_connections;
1519+ HashMap<ConnectionKey, const List<Connection>::Element *> input_connections;
15211520
15221521 for (const List<Connection>::Element *E = graph[p_type].connections .front (); E; E = E->next ()) {
1523- ConnectionKey from_key;
1524- from_key.node = E->get ().from_node ;
1525- from_key.port = E->get ().from_port ;
1526-
1527- output_connections.insert (from_key, E);
1528-
15291522 ConnectionKey to_key;
15301523 to_key.node = E->get ().to_node ;
15311524 to_key.port = E->get ().to_port ;
@@ -1536,7 +1529,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
15361529 shader_code += " \n void fragment() {\n " ;
15371530
15381531 HashSet<int > processed;
1539- Error err = _write_node (p_type, &global_code, &global_code_per_node, &global_code_per_func, shader_code, default_tex_params, input_connections, output_connections, p_node, processed, true , classes);
1532+ Error err = _write_node (p_type, &global_code, &global_code_per_node, &global_code_per_func, shader_code, default_tex_params, input_connections, p_node, processed, true , classes);
15401533 ERR_FAIL_COND_V (err != OK, String ());
15411534
15421535 switch (node->get_output_port_type (p_port)) {
@@ -1955,7 +1948,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
19551948 }
19561949}
19571950
1958- Error VisualShader::_write_node (Type type, StringBuilder *p_global_code, StringBuilder *p_global_code_per_node, HashMap<Type, StringBuilder> *p_global_code_per_func, StringBuilder &r_code, Vector<VisualShader::DefaultTextureParam> &r_def_tex_params, const VMap <ConnectionKey, const List<Connection>::Element *> &p_input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &p_output_connections , int p_node, HashSet<int > &r_processed, bool p_for_preview, HashSet<StringName> &r_classes) const {
1951+ Error VisualShader::_write_node (Type type, StringBuilder *p_global_code, StringBuilder *p_global_code_per_node, HashMap<Type, StringBuilder> *p_global_code_per_func, StringBuilder &r_code, Vector<VisualShader::DefaultTextureParam> &r_def_tex_params, const HashMap <ConnectionKey, const List<Connection>::Element *> &p_input_connections, int p_node, HashSet<int > &r_processed, bool p_for_preview, HashSet<StringName> &r_classes) const {
19591952 const Ref<VisualShaderNode> vsnode = graph[type].nodes [p_node].node ;
19601953
19611954 if (vsnode->is_disabled ()) {
@@ -1977,7 +1970,7 @@ Error VisualShader::_write_node(Type type, StringBuilder *p_global_code, StringB
19771970 continue ;
19781971 }
19791972
1980- Error err = _write_node (type, p_global_code, p_global_code_per_node, p_global_code_per_func, r_code, r_def_tex_params, p_input_connections, p_output_connections, from_node, r_processed, p_for_preview, r_classes);
1973+ Error err = _write_node (type, p_global_code, p_global_code_per_node, p_global_code_per_func, r_code, r_def_tex_params, p_input_connections, from_node, r_processed, p_for_preview, r_classes);
19811974 if (err) {
19821975 return err;
19831976 }
@@ -2702,8 +2695,7 @@ void VisualShader::_update_shader() const {
27022695 }
27032696
27042697 // make it faster to go around through shader
2705- VMap<ConnectionKey, const List<Connection>::Element *> input_connections;
2706- VMap<ConnectionKey, const List<Connection>::Element *> output_connections;
2698+ HashMap<ConnectionKey, const List<Connection>::Element *> input_connections;
27072699
27082700 StringBuilder func_code;
27092701 HashSet<int > processed;
@@ -2764,12 +2756,6 @@ void VisualShader::_update_shader() const {
27642756 }
27652757
27662758 for (const List<Connection>::Element *E = graph[i].connections .front (); E; E = E->next ()) {
2767- ConnectionKey from_key;
2768- from_key.node = E->get ().from_node ;
2769- from_key.port = E->get ().from_port ;
2770-
2771- output_connections.insert (from_key, E);
2772-
27732759 ConnectionKey to_key;
27742760 to_key.node = E->get ().to_node ;
27752761 to_key.port = E->get ().to_port ;
@@ -2791,19 +2777,19 @@ void VisualShader::_update_shader() const {
27912777 }
27922778 insertion_pos.insert (i, shader_code.get_string_length () + func_code.get_string_length ());
27932779
2794- Error err = _write_node (Type (i), &global_code, &global_code_per_node, &global_code_per_func, func_code, default_tex_params, input_connections, output_connections, NODE_ID_OUTPUT, processed, false , classes);
2780+ Error err = _write_node (Type (i), &global_code, &global_code_per_node, &global_code_per_func, func_code, default_tex_params, input_connections, NODE_ID_OUTPUT, processed, false , classes);
27952781 ERR_FAIL_COND (err != OK);
27962782
27972783 if (varying_setters.has (i)) {
27982784 for (int &E : varying_setters[i]) {
2799- err = _write_node (Type (i), &global_code, &global_code_per_node, nullptr , func_code, default_tex_params, input_connections, output_connections, E, processed, false , classes);
2785+ err = _write_node (Type (i), &global_code, &global_code_per_node, nullptr , func_code, default_tex_params, input_connections, E, processed, false , classes);
28002786 ERR_FAIL_COND (err != OK);
28012787 }
28022788 }
28032789
28042790 if (emitters.has (i)) {
28052791 for (int &E : emitters[i]) {
2806- err = _write_node (Type (i), &global_code, &global_code_per_node, &global_code_per_func, func_code, default_tex_params, input_connections, output_connections, E, processed, false , classes);
2792+ err = _write_node (Type (i), &global_code, &global_code_per_node, &global_code_per_func, func_code, default_tex_params, input_connections, E, processed, false , classes);
28072793 ERR_FAIL_COND (err != OK);
28082794 }
28092795 }
0 commit comments