vk_pipeline_cache: Remove unnecesary scope in pipeline cache locking

This commit is contained in:
ReinUsesLisp 2021-04-03 05:19:13 -03:00 committed by ameerj
parent 9a342f5605
commit 6ff2e9ba09

View File

@ -539,14 +539,12 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
ShaderPools pools; ShaderPools pools;
auto pipeline{CreateComputePipeline(pools, key, envs.front(), false)}; auto pipeline{CreateComputePipeline(pools, key, envs.front(), false)};
{
std::lock_guard lock{state.mutex}; std::lock_guard lock{state.mutex};
compute_cache.emplace(key, std::move(pipeline)); compute_cache.emplace(key, std::move(pipeline));
++state.built; ++state.built;
if (state.has_loaded) { if (state.has_loaded) {
callback(VideoCore::LoadCallbackStage::Build, state.built, state.total); callback(VideoCore::LoadCallbackStage::Build, state.built, state.total);
} }
}
}); });
} else { } else {
GraphicsPipelineCacheKey key; GraphicsPipelineCacheKey key;
@ -560,14 +558,12 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
} }
auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), false)}; auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), false)};
{
std::lock_guard lock{state.mutex}; std::lock_guard lock{state.mutex};
graphics_cache.emplace(key, std::move(pipeline)); graphics_cache.emplace(key, std::move(pipeline));
++state.built; ++state.built;
if (state.has_loaded) { if (state.has_loaded) {
callback(VideoCore::LoadCallbackStage::Build, state.built, state.total); callback(VideoCore::LoadCallbackStage::Build, state.built, state.total);
} }
}
}); });
} }
++state.total; ++state.total;
@ -635,7 +631,8 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_,
float_control.shaderSignedZeroInfNanPreserveFloat64 != VK_FALSE, float_control.shaderSignedZeroInfNanPreserveFloat64 != VK_FALSE,
.support_explicit_workgroup_layout = device.IsKhrWorkgroupMemoryExplicitLayoutSupported(), .support_explicit_workgroup_layout = device.IsKhrWorkgroupMemoryExplicitLayoutSupported(),
.support_vote = true, .support_vote = true,
.support_viewport_index_layer_non_geometry = device.IsExtShaderViewportIndexLayerSupported(), .support_viewport_index_layer_non_geometry =
device.IsExtShaderViewportIndexLayerSupported(),
.warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(), .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(),
.has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR, .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR,
.generic_input_types{}, .generic_input_types{},