Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.

Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
This commit is contained in:
Lukas Tenbrink 2025-05-15 11:50:46 +02:00
parent 06827c91c6
commit ad600125df
29 changed files with 253 additions and 222 deletions

View file

@ -487,7 +487,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
static void _uniform_set_invalidation_callback(void *p_userdata);
static void _canvas_texture_invalidation_callback(bool p_deleted, void *p_userdata);
typedef LRUCache<RIDSetKey, RID, HashableHasher<RIDSetKey>, HashMapComparatorDefault<RIDSetKey>, _before_evict> RIDCache;
typedef LRUCache<RIDSetKey, RID, HashMapHasherDefault, HashMapComparatorDefault<RIDSetKey>, _before_evict> RIDCache;
RIDCache rid_set_to_uniform_set;
/// Maps a CanvasTexture to its associated uniform sets, which must
/// be invalidated when the CanvasTexture is updated, such as changing the
@ -526,7 +526,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
uint32_t flags = 0;
};
HashMap<TextureState, TextureInfo, HashableHasher<TextureState>, HashMapComparatorDefault<TextureState>, PagedAllocator<HashMapElement<TextureState, TextureInfo>>> texture_info_map;
HashMap<TextureState, TextureInfo, HashMapHasherDefault, HashMapComparatorDefault<TextureState>, PagedAllocator<HashMapElement<TextureState, TextureInfo>>> texture_info_map;
// per-frame buffers
struct DataBuffer {