summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2017-02-15 14:41:16 +0100
committerHein-Pieter van Braam <hp@tmm.cx>2017-02-16 18:44:29 +0100
commitb696beea65bbffd31edac169ccf9708f46ab9652 (patch)
tree27bd4f630dda96d028aa0efd7752000844ac996b /drivers/gles3
parent903a3aa5f0e128abb1fb752c10b343b34af8f799 (diff)
Correct hash behavior for floating point numbers
This fixes HashMap where a key or part of a key is a floating point number. To fix this the following has been done: * HashMap now takes an extra template argument Comparator. This class gets used to compare keys. The default Comperator now works correctly for common types and floating point numbets. * Variant implements ::hash_compare() now. This function implements nan-safe comparison for all types with components that contain floating point numbers. * Variant now has a VariantComparator which uses Variant::hash_compare() safely compare floating point components of variant's types. * The hash functions for floating point numbers will now normalize NaN values so that all floating point numbers that are NaN hash to the same value. C++ module writers that want to use HashMap internally in their modules can now also safeguard against this crash by defining their on Comperator class that safely compares their types. GDScript users, or writers of modules that don't use HashMap internally in their modules don't need to do anything. This fixes #7354 and fixes #6947.
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shader_gles3.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h
index ee8db2ac8c..c2d283d492 100644
--- a/drivers/gles3/shader_gles3.h
+++ b/drivers/gles3/shader_gles3.h
@@ -149,7 +149,7 @@ private:
struct VersionKeyHash {
- static _FORCE_INLINE_ uint32_t hash( const VersionKey& p_key) { return HashMapHahserDefault::hash(p_key.key); };
+ static _FORCE_INLINE_ uint32_t hash( const VersionKey& p_key) { return HashMapHasherDefault::hash(p_key.key); };
};
//this should use a way more cachefriendly version..