From c5047540c9c3f807ed2164b938898ffff27f53bc Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 2 Apr 2019 15:54:11 -0300 Subject: video_core: Abstract vk_sampler_cache into a templated class --- src/video_core/sampler_cache.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/video_core/sampler_cache.cpp (limited to 'src/video_core/sampler_cache.cpp') diff --git a/src/video_core/sampler_cache.cpp b/src/video_core/sampler_cache.cpp new file mode 100644 index 000000000..53c7ef12d --- /dev/null +++ b/src/video_core/sampler_cache.cpp @@ -0,0 +1,21 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/cityhash.h" +#include "common/common_types.h" +#include "video_core/sampler_cache.h" + +namespace VideoCommon { + +std::size_t SamplerCacheKey::Hash() const { + static_assert(sizeof(raw) % sizeof(u64) == 0); + return static_cast( + Common::CityHash64(reinterpret_cast(raw.data()), sizeof(raw) / sizeof(u64))); +} + +bool SamplerCacheKey::operator==(const SamplerCacheKey& rhs) const { + return raw == rhs.raw; +} + +} // namespace VideoCommon -- cgit v1.2.3