mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
Merge pull request #12545 from lioncash/hash
VideoCommon: Collapse hash specialization namespaces
This commit is contained in:
commit
2509164ce4
@ -79,14 +79,12 @@ struct PortableVertexDeclaration
|
||||
static_assert(std::is_trivially_copyable_v<PortableVertexDeclaration>,
|
||||
"Make sure we can memset-initialize");
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<PortableVertexDeclaration>
|
||||
struct std::hash<PortableVertexDeclaration>
|
||||
{
|
||||
// Implementation from Wikipedia.
|
||||
template <typename T>
|
||||
u32 Fletcher32(const T& data) const
|
||||
static u32 Fletcher32(const T& data)
|
||||
{
|
||||
static_assert(sizeof(T) % sizeof(u16) == 0);
|
||||
|
||||
@ -114,9 +112,11 @@ struct hash<PortableVertexDeclaration>
|
||||
sum2 = (sum2 & 0xffff) + (sum2 >> 16);
|
||||
return (sum2 << 16 | sum1);
|
||||
}
|
||||
size_t operator()(const PortableVertexDeclaration& decl) const { return Fletcher32(decl); }
|
||||
size_t operator()(const PortableVertexDeclaration& decl) const noexcept
|
||||
{
|
||||
return Fletcher32(decl);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp
|
||||
// is in the respective backend, not here in VideoCommon.
|
||||
|
@ -220,17 +220,14 @@ struct SamplerState
|
||||
TM1 tm1;
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<SamplerState>
|
||||
struct std::hash<SamplerState>
|
||||
{
|
||||
std::size_t operator()(SamplerState const& state) const noexcept
|
||||
std::size_t operator()(const SamplerState& state) const noexcept
|
||||
{
|
||||
return std::hash<u64>{}(state.Hex());
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
namespace RenderState
|
||||
{
|
||||
|
@ -79,10 +79,8 @@ struct TextureConfig
|
||||
AbstractTextureType type = AbstractTextureType::Texture_2DArray;
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<TextureConfig>
|
||||
struct std::hash<TextureConfig>
|
||||
{
|
||||
using argument_type = TextureConfig;
|
||||
using result_type = size_t;
|
||||
@ -95,4 +93,3 @@ struct hash<TextureConfig>
|
||||
return std::hash<u64>{}(id);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
@ -46,14 +46,11 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<VertexLoaderUID>
|
||||
struct std::hash<VertexLoaderUID>
|
||||
{
|
||||
size_t operator()(const VertexLoaderUID& uid) const { return uid.GetHash(); }
|
||||
size_t operator()(const VertexLoaderUID& uid) const noexcept { return uid.GetHash(); }
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
class VertexLoaderBase
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user