diff options
| author | 2019-04-02 15:54:11 -0300 | |
|---|---|---|
| committer | 2019-04-02 15:54:11 -0300 | |
| commit | c5047540c9c3f807ed2164b938898ffff27f53bc (patch) | |
| tree | 317395c2df72428942d25ac3d185d763cb52972d /src/video_core/sampler_cache.cpp | |
| parent | Merge pull request #2316 from ReinUsesLisp/fixup-process (diff) | |
| download | yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.gz yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.xz yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.zip | |
video_core: Abstract vk_sampler_cache into a templated class
Diffstat (limited to 'src/video_core/sampler_cache.cpp')
| -rw-r--r-- | src/video_core/sampler_cache.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/cityhash.h" | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "video_core/sampler_cache.h" | ||
| 8 | |||
| 9 | namespace VideoCommon { | ||
| 10 | |||
| 11 | std::size_t SamplerCacheKey::Hash() const { | ||
| 12 | static_assert(sizeof(raw) % sizeof(u64) == 0); | ||
| 13 | return static_cast<std::size_t>( | ||
| 14 | Common::CityHash64(reinterpret_cast<const char*>(raw.data()), sizeof(raw) / sizeof(u64))); | ||
| 15 | } | ||
| 16 | |||
| 17 | bool SamplerCacheKey::operator==(const SamplerCacheKey& rhs) const { | ||
| 18 | return raw == rhs.raw; | ||
| 19 | } | ||
| 20 | |||
| 21 | } // namespace VideoCommon | ||