diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-07 01:29:13 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-07 02:02:26 +0100 |
commit | 2effdeb9243b5ca80a696b9bc003fb0179e0b6bd (patch) | |
tree | 5a082ab5ed4b37d6eb9a4ad05f47d7fa7370ff17 /src/video_core/renderer_vulkan/vk_pipeline_cache.h | |
parent | vk_compute_pipeline: Initial implementation (diff) | |
download | yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar.gz yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar.bz2 yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar.lz yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar.xz yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.tar.zst yuzu-2effdeb9243b5ca80a696b9bc003fb0179e0b6bd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index 33b1a1d23..e49ed135d 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h @@ -8,9 +8,12 @@ #include <cstddef> #include <vector> +#include <boost/functional/hash.hpp> + #include "common/common_types.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/renderer_vulkan/declarations.h" +#include "video_core/renderer_vulkan/fixed_pipeline_state.h" #include "video_core/renderer_vulkan/vk_shader_decompiler.h" #include "video_core/shader/shader_ir.h" @@ -18,6 +21,28 @@ namespace Vulkan { class VKDevice; +using Maxwell = Tegra::Engines::Maxwell3D::Regs; + +struct GraphicsPipelineCacheKey { + FixedPipelineState fixed_state; + std::array<GPUVAddr, Maxwell::MaxShaderProgram> shaders; + RenderPassParams renderpass_params; + + std::size_t Hash() const noexcept { + std::size_t hash = fixed_state.Hash(); + for (const auto& shader : shaders) { + boost::hash_combine(hash, shader); + } + boost::hash_combine(hash, renderpass_params.Hash()); + return hash; + } + + bool operator==(const GraphicsPipelineCacheKey& rhs) const noexcept { + return std::tie(fixed_state, shaders, renderpass_params) == + std::tie(rhs.fixed_state, rhs.shaders, rhs.renderpass_params); + } +}; + struct ComputePipelineCacheKey { GPUVAddr shader{}; u32 shared_memory_size{}; @@ -42,6 +67,13 @@ struct ComputePipelineCacheKey { namespace std { template <> +struct hash<Vulkan::GraphicsPipelineCacheKey> { + std::size_t operator()(const Vulkan::GraphicsPipelineCacheKey& k) const noexcept { + return k.Hash(); + } +}; + +template <> struct hash<Vulkan::ComputePipelineCacheKey> { std::size_t operator()(const Vulkan::ComputePipelineCacheKey& k) const noexcept { return k.Hash(); |