From 3b074f07e66a5d05166d902220fa9363d20a1694 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Sun, 15 Sep 2024 22:11:26 +0300 Subject: [PATCH] pipeline_cache: Allocate pipelines from pools --- .../renderer_vulkan/vk_pipeline_cache.cpp | 15 ++++++--------- .../renderer_vulkan/vk_pipeline_cache.h | 6 ++++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 8de654bd9..7f6079a5c 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -167,11 +167,10 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() { } const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key); if (is_new) { - it.value() = std::make_unique( - instance, scheduler, desc_heap, graphics_key, *pipeline_cache, infos, modules); + it.value() = graphics_pipeline_pool.Create(instance, scheduler, desc_heap, graphics_key, + *pipeline_cache, infos, modules); } - const GraphicsPipeline* pipeline = it->second.get(); - return pipeline; + return it->second; } const ComputePipeline* PipelineCache::GetComputePipeline() { @@ -180,11 +179,10 @@ const ComputePipeline* PipelineCache::GetComputePipeline() { } const auto [it, is_new] = compute_pipelines.try_emplace(compute_key); if (is_new) { - it.value() = std::make_unique( - instance, scheduler, desc_heap, *pipeline_cache, compute_key, *infos[0], modules[0]); + it.value() = compute_pipeline_pool.Create(instance, scheduler, desc_heap, *pipeline_cache, + compute_key, *infos[0], modules[0]); } - const ComputePipeline* pipeline = it->second.get(); - return pipeline; + return it->second; } bool ShouldSkipShader(u64 shader_hash, const char* shader_type) { @@ -218,7 +216,6 @@ bool PipelineCache::RefreshGraphicsKey() { key.depth_stencil.depth_enable.Assign(key.depth_format != vk::Format::eUndefined); } key.stencil = regs.stencil_control; - key.stencil.raw &= Liverpool::StencilControl::Mask(); if (db.stencil_info.format != AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid) { key.stencil_format = key.depth_format; diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index 92dcf8262..7f0064fb8 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h @@ -74,8 +74,10 @@ private: Shader::Pools pools; tsl::robin_map program_cache; Common::ObjectPool program_pool; - tsl::robin_map> compute_pipelines; - tsl::robin_map> graphics_pipelines; + Common::ObjectPool graphics_pipeline_pool; + Common::ObjectPool compute_pipeline_pool; + tsl::robin_map compute_pipelines; + tsl::robin_map graphics_pipelines; std::array infos{}; std::array modules{}; GraphicsPipelineKey graphics_key{};