diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-02 20:54:11 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-02 20:54:11 +0200 |
commit | c5047540c9c3f807ed2164b938898ffff27f53bc (patch) | |
tree | 317395c2df72428942d25ac3d185d763cb52972d /src/video_core/renderer_vulkan/vk_sampler_cache.h | |
parent | Merge pull request #2316 from ReinUsesLisp/fixup-process (diff) | |
download | yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.gz yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.bz2 yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.lz yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.xz yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.tar.zst yuzu-c5047540c9c3f807ed2164b938898ffff27f53bc.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_sampler_cache.h | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.h b/src/video_core/renderer_vulkan/vk_sampler_cache.h index c6394dc87..771b05c73 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.h +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.h @@ -8,49 +8,25 @@ #include "common/common_types.h" #include "video_core/renderer_vulkan/declarations.h" +#include "video_core/sampler_cache.h" #include "video_core/textures/texture.h" namespace Vulkan { class VKDevice; -struct SamplerCacheKey final : public Tegra::Texture::TSCEntry { - std::size_t Hash() const; - - bool operator==(const SamplerCacheKey& rhs) const; - - bool operator!=(const SamplerCacheKey& rhs) const { - return !operator==(rhs); - } -}; - -} // namespace Vulkan - -namespace std { - -template <> -struct hash<Vulkan::SamplerCacheKey> { - std::size_t operator()(const Vulkan::SamplerCacheKey& k) const noexcept { - return k.Hash(); - } -}; - -} // namespace std - -namespace Vulkan { - -class VKSamplerCache { +class VKSamplerCache final : public VideoCommon::SamplerCache<vk::Sampler, UniqueSampler> { public: explicit VKSamplerCache(const VKDevice& device); ~VKSamplerCache(); - vk::Sampler GetSampler(const Tegra::Texture::TSCEntry& tsc); +protected: + UniqueSampler CreateSampler(const Tegra::Texture::TSCEntry& tsc) const; -private: - UniqueSampler CreateSampler(const Tegra::Texture::TSCEntry& tsc); + vk::Sampler ToSamplerType(const UniqueSampler& sampler) const; +private: const VKDevice& device; - std::unordered_map<SamplerCacheKey, UniqueSampler> cache; }; } // namespace Vulkan |