From 45af29da8095af16729955117a165d23e77cd740 Mon Sep 17 00:00:00 2001 From: reduz Date: Thu, 19 May 2022 17:00:06 +0200 Subject: Add a new HashSet template * Intended to replace RBSet in most cases. * Optimized for iteration speed --- scene/resources/visual_shader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'scene/resources/visual_shader.cpp') diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index d361aa876b..18bb0ff01d 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1180,7 +1180,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port StringBuilder global_code_per_node; HashMap global_code_per_func; StringBuilder code; - RBSet classes; + HashSet classes; global_code += String() + "shader_type canvas_item;\n"; @@ -1222,7 +1222,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port code += "\nvoid fragment() {\n"; - RBSet processed; + HashSet processed; Error err = _write_node(p_type, &global_code, &global_code_per_node, &global_code_per_func, code, default_tex_params, input_connections, output_connections, p_node, processed, true, classes); ERR_FAIL_COND_V(err != OK, String()); @@ -1551,7 +1551,7 @@ void VisualShader::_get_property_list(List *p_list) const { //render modes HashMap blend_mode_enums; - RBSet toggles; + HashSet toggles; const Vector &rmodes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)); @@ -1611,7 +1611,7 @@ void VisualShader::_get_property_list(List *p_list) const { } } -Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap *global_code_per_func, StringBuilder &code, Vector &def_tex_params, const VMap::Element *> &input_connections, const VMap::Element *> &output_connections, int node, RBSet &processed, bool for_preview, RBSet &r_classes) const { +Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap *global_code_per_func, StringBuilder &code, Vector &def_tex_params, const VMap::Element *> &input_connections, const VMap::Element *> &output_connections, int node, HashSet &processed, bool for_preview, HashSet &r_classes) const { const Ref vsnode = graph[type].nodes[node].node; if (vsnode->is_disabled()) { @@ -2136,7 +2136,7 @@ void VisualShader::_update_shader() const { HashMap global_code_per_func; StringBuilder code; Vector default_tex_params; - RBSet classes; + HashSet classes; HashMap insertion_pos; static const char *shader_mode_str[Shader::MODE_MAX] = { "spatial", "canvas_item", "particles", "sky", "fog" }; @@ -2181,7 +2181,7 @@ void VisualShader::_update_shader() const { static const char *func_name[TYPE_MAX] = { "vertex", "fragment", "light", "start", "process", "collide", "start_custom", "process_custom", "sky", "fog" }; String global_expressions; - RBSet used_uniform_names; + HashSet used_uniform_names; List uniforms; HashMap> emitters; HashMap> varying_setters; @@ -2270,7 +2270,7 @@ void VisualShader::_update_shader() const { } HashMap code_map; - RBSet empty_funcs; + HashSet empty_funcs; for (int i = 0; i < TYPE_MAX; i++) { if (!has_func_name(RenderingServer::ShaderMode(shader_mode), func_name[i])) { @@ -2282,7 +2282,7 @@ void VisualShader::_update_shader() const { VMap::Element *> output_connections; StringBuilder func_code; - RBSet processed; + HashSet processed; bool is_empty_func = false; if (shader_mode != Shader::MODE_PARTICLES && shader_mode != Shader::MODE_SKY && shader_mode != Shader::MODE_FOG) { -- cgit v1.2.3