diff options
| author | Mathew Maidment <mathew1800@gmail.com> | 2016-01-24 17:18:08 -0500 |
|---|---|---|
| committer | Mathew Maidment <mathew1800@gmail.com> | 2016-01-24 17:18:08 -0500 |
| commit | bad7242c634edcee5ecbc54f31c982efffbfd367 (patch) | |
| tree | b4bfbe2f50fec1b5806110663a4a993b31f3caca /Source/Core/VideoCommon | |
| parent | e9713e19d778e6a155840c4d0e0c46acd0bae6a5 (diff) | |
| parent | 59d5935067c7f247ef2ea727eadb8a7285f729a6 (diff) | |
Merge pull request #3559 from lioncash/tcache
TextureCacheBase: Simplify init/comparison of TCacheEntryConfig
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index b22466e381..b753fab1f9 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -6,6 +6,7 @@ #include <map> #include <memory> +#include <tuple> #include <unordered_map> #include "Common/CommonTypes.h" @@ -20,26 +21,30 @@ class TextureCacheBase public: struct TCacheEntryConfig { - TCacheEntryConfig() : width(0), height(0), levels(1), layers(1), rendertarget(false) {} + constexpr TCacheEntryConfig() = default; - u32 width, height; - u32 levels, layers; - bool rendertarget; - - bool operator == (const TCacheEntryConfig& b) const + bool operator==(const TCacheEntryConfig& o) const { - return width == b.width && height == b.height && levels == b.levels && layers == b.layers && rendertarget == b.rendertarget; + return std::tie(width, height, levels, layers, rendertarget) == + std::tie(o.width, o.height, o.levels, o.layers, o.rendertarget); } struct Hasher : std::hash<u64> { - size_t operator()(const TextureCacheBase::TCacheEntryConfig& c) const + size_t operator()(const TCacheEntryConfig& c) const { u64 id = (u64)c.rendertarget << 63 | (u64)c.layers << 48 | (u64)c.levels << 32 | (u64)c.height << 16 | (u64)c.width; return std::hash<u64>::operator()(id); } }; + + u32 width = 0; + u32 height = 0; + u32 levels = 1; + u32 layers = 1; + bool rendertarget = false; }; + struct TCacheEntryBase { const TCacheEntryConfig config; |
