diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-05 04:03:49 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-05 05:24:51 +0200 |
commit | 5b2b6d594c6cfa77c3fb92faee63ad524bfe7204 (patch) | |
tree | 807efa01ce6b050f9660ab50a15d355d0be05bd5 /src/video_core/shader/registry.h | |
parent | shader/track: Move bindless tracking to a separate function (diff) | |
download | yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.gz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.bz2 yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.lz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.xz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.zst yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.zip |
Diffstat (limited to 'src/video_core/shader/registry.h')
-rw-r--r-- | src/video_core/shader/registry.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/video_core/shader/registry.h b/src/video_core/shader/registry.h index 0c80d35fd..231206765 100644 --- a/src/video_core/shader/registry.h +++ b/src/video_core/shader/registry.h @@ -19,8 +19,39 @@ namespace VideoCommon::Shader { +struct SeparateSamplerKey { + std::pair<u32, u32> buffers; + std::pair<u32, u32> offsets; +}; + +} // namespace VideoCommon::Shader + +namespace std { + +template <> +struct hash<VideoCommon::Shader::SeparateSamplerKey> { + std::size_t operator()(const VideoCommon::Shader::SeparateSamplerKey& key) const noexcept { + return std::hash<u32>{}(key.buffers.first ^ key.buffers.second ^ key.offsets.first ^ + key.offsets.second); + } +}; + +template <> +struct equal_to<VideoCommon::Shader::SeparateSamplerKey> { + bool operator()(const VideoCommon::Shader::SeparateSamplerKey& lhs, + const VideoCommon::Shader::SeparateSamplerKey& rhs) const noexcept { + return lhs.buffers == rhs.buffers && lhs.offsets == rhs.offsets; + } +}; + +} // namespace std + +namespace VideoCommon::Shader { + using KeyMap = std::unordered_map<std::pair<u32, u32>, u32, Common::PairHash>; using BoundSamplerMap = std::unordered_map<u32, Tegra::Engines::SamplerDescriptor>; +using SeparateSamplerMap = + std::unordered_map<SeparateSamplerKey, Tegra::Engines::SamplerDescriptor>; using BindlessSamplerMap = std::unordered_map<std::pair<u32, u32>, Tegra::Engines::SamplerDescriptor, Common::PairHash>; @@ -73,6 +104,9 @@ public: std::optional<Tegra::Engines::SamplerDescriptor> ObtainBoundSampler(u32 offset); + std::optional<Tegra::Engines::SamplerDescriptor> ObtainSeparateSampler( + std::pair<u32, u32> buffers, std::pair<u32, u32> offsets); + std::optional<Tegra::Engines::SamplerDescriptor> ObtainBindlessSampler(u32 buffer, u32 offset); /// Inserts a key. @@ -128,6 +162,7 @@ private: Tegra::Engines::ConstBufferEngineInterface* engine = nullptr; KeyMap keys; BoundSamplerMap bound_samplers; + SeparateSamplerMap separate_samplers; BindlessSamplerMap bindless_samplers; u32 bound_buffer; GraphicsInfo graphics_info; |