diff options
| author | 2022-04-07 19:32:40 +0100 | |
|---|---|---|
| committer | 2022-04-07 19:44:07 +0100 | |
| commit | bbc585881a69b899bfaa9c2982c87a2034d4331e (patch) | |
| tree | aa24a84a9a885da4a112d943ec267b02bba83e39 /src/video_core/renderer_vulkan | |
| parent | input_common: Replace lock_guard with scoped_lock (diff) | |
| download | yuzu-bbc585881a69b899bfaa9c2982c87a2034d4331e.tar.gz yuzu-bbc585881a69b899bfaa9c2982c87a2034d4331e.tar.xz yuzu-bbc585881a69b899bfaa9c2982c87a2034d4331e.zip | |
video_core: Replace lock_guard with scoped_lock
Diffstat (limited to 'src/video_core/renderer_vulkan')
6 files changed, 10 insertions, 10 deletions
diff --git a/src/video_core/renderer_vulkan/pipeline_statistics.cpp b/src/video_core/renderer_vulkan/pipeline_statistics.cpp index bfec931a6..7ccadf084 100644 --- a/src/video_core/renderer_vulkan/pipeline_statistics.cpp +++ b/src/video_core/renderer_vulkan/pipeline_statistics.cpp | |||
| @@ -57,7 +57,7 @@ void PipelineStatistics::Collect(VkPipeline pipeline) { | |||
| 57 | stage_stats.basic_block_count = GetUint64(statistic); | 57 | stage_stats.basic_block_count = GetUint64(statistic); |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | std::lock_guard lock{mutex}; | 60 | std::scoped_lock lock{mutex}; |
| 61 | collected_stats.push_back(stage_stats); | 61 | collected_stats.push_back(stage_stats); |
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| @@ -66,7 +66,7 @@ void PipelineStatistics::Report() const { | |||
| 66 | double num{}; | 66 | double num{}; |
| 67 | Stats total; | 67 | Stats total; |
| 68 | { | 68 | { |
| 69 | std::lock_guard lock{mutex}; | 69 | std::scoped_lock lock{mutex}; |
| 70 | for (const Stats& stats : collected_stats) { | 70 | for (const Stats& stats : collected_stats) { |
| 71 | total.code_size += stats.code_size; | 71 | total.code_size += stats.code_size; |
| 72 | total.register_count += stats.register_count; | 72 | total.register_count += stats.register_count; |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index de36bcdb7..97b3594c2 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -77,7 +77,7 @@ ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descript | |||
| 77 | if (pipeline_statistics) { | 77 | if (pipeline_statistics) { |
| 78 | pipeline_statistics->Collect(*pipeline); | 78 | pipeline_statistics->Collect(*pipeline); |
| 79 | } | 79 | } |
| 80 | std::lock_guard lock{build_mutex}; | 80 | std::scoped_lock lock{build_mutex}; |
| 81 | is_built = true; | 81 | is_built = true; |
| 82 | build_condvar.notify_one(); | 82 | build_condvar.notify_one(); |
| 83 | if (shader_notify) { | 83 | if (shader_notify) { |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index d514b71d0..8959d6059 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -258,7 +258,7 @@ GraphicsPipeline::GraphicsPipeline( | |||
| 258 | pipeline_statistics->Collect(*pipeline); | 258 | pipeline_statistics->Collect(*pipeline); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | std::lock_guard lock{build_mutex}; | 261 | std::scoped_lock lock{build_mutex}; |
| 262 | is_built = true; | 262 | is_built = true; |
| 263 | build_condvar.notify_one(); | 263 | build_condvar.notify_one(); |
| 264 | if (shader_notify) { | 264 | if (shader_notify) { |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 27e59df73..336d1e9dc 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -404,7 +404,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading | |||
| 404 | workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable { | 404 | workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable { |
| 405 | ShaderPools pools; | 405 | ShaderPools pools; |
| 406 | auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)}; | 406 | auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)}; |
| 407 | std::lock_guard lock{state.mutex}; | 407 | std::scoped_lock lock{state.mutex}; |
| 408 | if (pipeline) { | 408 | if (pipeline) { |
| 409 | compute_cache.emplace(key, std::move(pipeline)); | 409 | compute_cache.emplace(key, std::move(pipeline)); |
| 410 | } | 410 | } |
| @@ -434,7 +434,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading | |||
| 434 | auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), | 434 | auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), |
| 435 | state.statistics.get(), false)}; | 435 | state.statistics.get(), false)}; |
| 436 | 436 | ||
| 437 | std::lock_guard lock{state.mutex}; | 437 | std::scoped_lock lock{state.mutex}; |
| 438 | graphics_cache.emplace(key, std::move(pipeline)); | 438 | graphics_cache.emplace(key, std::move(pipeline)); |
| 439 | ++state.built; | 439 | ++state.built; |
| 440 | if (state.has_loaded) { | 440 | if (state.has_loaded) { |
diff --git a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp index 451ffe019..d22bb6694 100644 --- a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp | |||
| @@ -36,7 +36,7 @@ VkAttachmentDescription AttachmentDescription(const Device& device, PixelFormat | |||
| 36 | RenderPassCache::RenderPassCache(const Device& device_) : device{&device_} {} | 36 | RenderPassCache::RenderPassCache(const Device& device_) : device{&device_} {} |
| 37 | 37 | ||
| 38 | VkRenderPass RenderPassCache::Get(const RenderPassKey& key) { | 38 | VkRenderPass RenderPassCache::Get(const RenderPassKey& key) { |
| 39 | std::lock_guard lock{mutex}; | 39 | std::scoped_lock lock{mutex}; |
| 40 | const auto [pair, is_new] = cache.try_emplace(key); | 40 | const auto [pair, is_new] = cache.try_emplace(key); |
| 41 | if (!is_new) { | 41 | if (!is_new) { |
| 42 | return *pair->second; | 42 | return *pair->second; |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index ad320991b..6a9416457 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp | |||
| @@ -73,7 +73,7 @@ void VKScheduler::DispatchWork() { | |||
| 73 | return; | 73 | return; |
| 74 | } | 74 | } |
| 75 | { | 75 | { |
| 76 | std::lock_guard lock{work_mutex}; | 76 | std::scoped_lock lock{work_mutex}; |
| 77 | work_queue.push(std::move(chunk)); | 77 | work_queue.push(std::move(chunk)); |
| 78 | } | 78 | } |
| 79 | work_cv.notify_one(); | 79 | work_cv.notify_one(); |
| @@ -157,7 +157,7 @@ void VKScheduler::WorkerThread(std::stop_token stop_token) { | |||
| 157 | if (has_submit) { | 157 | if (has_submit) { |
| 158 | AllocateWorkerCommandBuffer(); | 158 | AllocateWorkerCommandBuffer(); |
| 159 | } | 159 | } |
| 160 | std::lock_guard reserve_lock{reserve_mutex}; | 160 | std::scoped_lock reserve_lock{reserve_mutex}; |
| 161 | chunk_reserve.push_back(std::move(work)); | 161 | chunk_reserve.push_back(std::move(work)); |
| 162 | } while (!stop_token.stop_requested()); | 162 | } while (!stop_token.stop_requested()); |
| 163 | } | 163 | } |
| @@ -282,7 +282,7 @@ void VKScheduler::EndRenderPass() { | |||
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | void VKScheduler::AcquireNewChunk() { | 284 | void VKScheduler::AcquireNewChunk() { |
| 285 | std::lock_guard lock{reserve_mutex}; | 285 | std::scoped_lock lock{reserve_mutex}; |
| 286 | if (chunk_reserve.empty()) { | 286 | if (chunk_reserve.empty()) { |
| 287 | chunk = std::make_unique<CommandChunk>(); | 287 | chunk = std::make_unique<CommandChunk>(); |
| 288 | return; | 288 | return; |