diff options
author | ameerj <aj662@drexel.edu> | 2020-08-02 19:05:41 +0200 |
---|---|---|
committer | ameerj <aj662@drexel.edu> | 2020-08-16 18:02:22 +0200 |
commit | 31a76410e8fa09462d960c10148c075125dc385a (patch) | |
tree | a5e45c1f609cdf7d4537d1215699e741a469ba17 /src/video_core/renderer_vulkan/vk_graphics_pipeline.h | |
parent | Vk Async Worker directly emplace in cache (diff) | |
download | yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar.gz yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar.bz2 yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar.lz yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar.xz yuzu-31a76410e8fa09462d960c10148c075125dc385a.tar.zst yuzu-31a76410e8fa09462d960c10148c075125dc385a.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_graphics_pipeline.h')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h index d50bd347c..9d462db0a 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h @@ -19,7 +19,27 @@ namespace Vulkan { using Maxwell = Tegra::Engines::Maxwell3D::Regs; -struct GraphicsPipelineCacheKey; +struct GraphicsPipelineCacheKey { + RenderPassParams renderpass_params; + u32 padding; + std::array<GPUVAddr, Maxwell::MaxShaderProgram> shaders; + FixedPipelineState fixed_state; + + std::size_t Hash() const noexcept; + + bool operator==(const GraphicsPipelineCacheKey& rhs) const noexcept; + + bool operator!=(const GraphicsPipelineCacheKey& rhs) const noexcept { + return !operator==(rhs); + } + + std::size_t Size() const noexcept { + return sizeof(renderpass_params) + sizeof(padding) + sizeof(shaders) + fixed_state.Size(); + } +}; +static_assert(std::has_unique_object_representations_v<GraphicsPipelineCacheKey>); +static_assert(std::is_trivially_copyable_v<GraphicsPipelineCacheKey>); +static_assert(std::is_trivially_constructible_v<GraphicsPipelineCacheKey>); class VKDescriptorPool; class VKDevice; @@ -54,8 +74,8 @@ public: return renderpass; } - const GraphicsPipelineCacheKey& GetCacheKey() const { - return m_key; + GraphicsPipelineCacheKey GetCacheKey() const { + return cache_key; } private: @@ -74,8 +94,8 @@ private: const VKDevice& device; VKScheduler& scheduler; - const FixedPipelineState fixed_state; const u64 hash; + GraphicsPipelineCacheKey cache_key; vk::DescriptorSetLayout descriptor_set_layout; DescriptorAllocator descriptor_allocator; @@ -86,8 +106,6 @@ private: VkRenderPass renderpass; vk::Pipeline pipeline; - - const GraphicsPipelineCacheKey& m_key; }; } // namespace Vulkan |