From 4539073ce1d8fd6df03263e826d3805b4909e055 Mon Sep 17 00:00:00 2001 From: ameerj Date: Thu, 30 Jul 2020 15:41:11 -0400 Subject: Address feedback. Bruteforce delete duplicates --- src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/video_core/renderer_vulkan/vk_pipeline_cache.cpp') diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 45d4dcb8c..a7ce621ca 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -205,20 +205,20 @@ std::array VKPipelineCache::GetShaders() { return last_shaders = shaders; } -VKGraphicsPipeline& VKPipelineCache::GetGraphicsPipeline( +VKGraphicsPipeline* VKPipelineCache::GetGraphicsPipeline( const GraphicsPipelineCacheKey& key, VideoCommon::Shader::AsyncShaders& async_shaders) { MICROPROFILE_SCOPE(Vulkan_PipelineCache); if (last_graphics_pipeline && last_graphics_key == key) { - return *last_graphics_pipeline; + return last_graphics_pipeline; } last_graphics_key = key; if (device.UseAsynchronousShaders()) { auto work = async_shaders.GetCompletedWork(); - for (std::size_t i = 0; i < work.size(); ++i) { - auto& entry = graphics_cache.at(work[i].pipeline->GetCacheKey()); - entry = std::move(work[i].pipeline); + for (auto& w : work) { + auto& entry = graphics_cache.at(w.pipeline->GetCacheKey()); + entry = std::move(w.pipeline); } const auto [pair, is_cache_miss] = graphics_cache.try_emplace(key); if (is_cache_miss) { @@ -227,7 +227,8 @@ VKGraphicsPipeline& VKPipelineCache::GetGraphicsPipeline( async_shaders.QueueVulkanShader(this, bindings, program, key.renderpass_params, key.padding, key.shaders, key.fixed_state); } - return *(last_graphics_pipeline = graphics_cache.at(key).get()); + last_graphics_pipeline = graphics_cache.at(key).get(); + return last_graphics_pipeline; } const auto [pair, is_cache_miss] = graphics_cache.try_emplace(key); @@ -239,7 +240,8 @@ VKGraphicsPipeline& VKPipelineCache::GetGraphicsPipeline( update_descriptor_queue, renderpass_cache, key, bindings, program); } - return *(last_graphics_pipeline = entry.get()); + last_graphics_pipeline = entry.get(); + return last_graphics_pipeline; } VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCacheKey& key) { -- cgit v1.2.3