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 --- servers/rendering/renderer_rd/storage_rd/material_storage.cpp | 2 +- servers/rendering/renderer_rd/storage_rd/material_storage.h | 4 ++-- servers/rendering/renderer_rd/storage_rd/mesh_storage.h | 2 +- servers/rendering/renderer_rd/storage_rd/particles_storage.h | 2 +- servers/rendering/renderer_rd/storage_rd/texture_storage.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'servers/rendering/renderer_rd/storage_rd') diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 93f1f4e0d9..de9913be3f 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -2267,7 +2267,7 @@ void MaterialStorage::shader_free(RID p_rid) { //make material unreference this while (shader->owners.size()) { - material_set_shader(shader->owners.front()->get()->self, RID()); + material_set_shader((*shader->owners.begin())->self, RID()); } //clear data if exists diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.h b/servers/rendering/renderer_rd/storage_rd/material_storage.h index 7d4db49f78..f83df05355 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.h @@ -77,7 +77,7 @@ struct Shader { String code; ShaderType type; HashMap> default_texture_parameter; - RBSet owners; + HashSet owners; }; /* Material structs */ @@ -137,7 +137,7 @@ struct GlobalVariables { BUFFER_DIRTY_REGION_SIZE = 1024 }; struct Variable { - RBSet texture_materials; // materials using this + HashSet texture_materials; // materials using this RS::GlobalVariableType type; Variant value; diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h index d90bb2f128..7ce019cf98 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h @@ -141,7 +141,7 @@ struct Mesh { List instances; RID shadow_mesh; - RBSet shadow_owners; + HashSet shadow_owners; RendererStorage::Dependency dependency; }; diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.h b/servers/rendering/renderer_rd/storage_rd/particles_storage.h index eb55db19fb..115633d17a 100644 --- a/servers/rendering/renderer_rd/storage_rd/particles_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.h @@ -224,7 +224,7 @@ struct Particles { ParticleEmissionBuffer *emission_buffer = nullptr; RID emission_storage_buffer; - RBSet collisions; + HashSet collisions; RendererStorage::Dependency dependency; diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.h b/servers/rendering/renderer_rd/storage_rd/texture_storage.h index 029816cbda..418eb82808 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.h @@ -124,7 +124,7 @@ public: RID proxy_to; Vector proxies; - RBSet lightmap_users; + HashSet lightmap_users; RS::TextureDetectCallback detect_3d_callback = nullptr; void *detect_3d_callback_ud = nullptr; -- cgit v1.2.3