rhi: Fix handle std::hash specialization

This prevented hashing of non-const qualified types. The contract for
std::hash already implies that it is a callable for an lvalue reference
of the template type.
This commit is contained in:
Eidolon 2023-05-19 18:41:43 -05:00
parent 8d390c58d4
commit 7e4d61730e
2 changed files with 3 additions and 3 deletions

View file

@ -46,11 +46,11 @@ struct std::hash<srb2::rhi::GlCoreFramebufferKey>
{ {
std::size_t operator()(const srb2::rhi::GlCoreFramebufferKey& key) const std::size_t operator()(const srb2::rhi::GlCoreFramebufferKey& key) const
{ {
std::size_t color_hash = std::hash<const srb2::rhi::Handle<srb2::rhi::Texture>>()(key.color); std::size_t color_hash = std::hash<srb2::rhi::Handle<srb2::rhi::Texture>>()(key.color);
std::size_t depth_stencil_hash = 0; std::size_t depth_stencil_hash = 0;
if (key.depth_stencil) if (key.depth_stencil)
{ {
depth_stencil_hash = std::hash<const srb2::rhi::Handle<srb2::rhi::Renderbuffer>>()(*key.depth_stencil); depth_stencil_hash = std::hash<srb2::rhi::Handle<srb2::rhi::Renderbuffer>>()(*key.depth_stencil);
} }
return color_hash ^ (depth_stencil_hash << 1); return color_hash ^ (depth_stencil_hash << 1);
} }

View file

@ -314,7 +314,7 @@ namespace std
{ {
template <typename T> template <typename T>
struct hash<const srb2::rhi::Handle<T>> struct hash<srb2::rhi::Handle<T>>
{ {
std::size_t operator()(const srb2::rhi::Handle<T>& e) const std::size_t operator()(const srb2::rhi::Handle<T>& e) const
{ {