Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions impeller/renderer/backend/vulkan/pipeline_cache_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ PipelineCacheVK::PipelineCacheVK(std::shared_ptr<const Capabilities> caps,
OpenCacheFile(cache_directory_, kPipelineCacheFileName, vk_caps);

vk::PipelineCacheCreateInfo cache_info;

// TODO(csg): VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT is behind
// an extension. Check it and set it. If not, the implementation is doing
// unnecessary synchronization.
// cache_info.flags =
// vk::PipelineCacheCreateFlagBits::eExternallySynchronized;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what I'm reading in https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPipelineCacheCreateFlagBits.html it sounds like the idea would be to use this extension so we could use the mutex ourselves.

But since we don't have the extension it ends up being both us and the implementation blocking.

So we might as well just let the implementation do it for us.


if (existing_cache_data) {
cache_info.initialDataSize = existing_cache_data->GetSize();
cache_info.pInitialData = existing_cache_data->GetMapping();
Expand Down Expand Up @@ -126,7 +119,6 @@ vk::UniquePipeline PipelineCacheVK::CreatePipeline(
return {};
}

Lock lock(cache_mutex_);
auto [result, pipeline] =
strong_device->GetDevice().createGraphicsPipelineUnique(*cache_, info);
if (result != vk::Result::eSuccess) {
Expand All @@ -143,7 +135,6 @@ vk::UniquePipeline PipelineCacheVK::CreatePipeline(
return {};
}

Lock lock(cache_mutex_);
auto [result, pipeline] =
strong_device->GetDevice().createComputePipelineUnique(*cache_, info);
if (result != vk::Result::eSuccess) {
Expand All @@ -162,7 +153,6 @@ std::shared_ptr<fml::Mapping> PipelineCacheVK::CopyPipelineCacheData() const {
if (!IsValid()) {
return nullptr;
}
Lock lock(cache_mutex_);
auto [result, data] =
strong_device->GetDevice().getPipelineCacheData(*cache_);
if (result != vk::Result::eSuccess) {
Expand Down
3 changes: 1 addition & 2 deletions impeller/renderer/backend/vulkan/pipeline_cache_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class PipelineCacheVK {
const std::shared_ptr<const Capabilities> caps_;
std::weak_ptr<DeviceHolder> device_holder_;
const fml::UniqueFD cache_directory_;
mutable Mutex cache_mutex_;
vk::UniquePipelineCache cache_ IPLR_GUARDED_BY(cache_mutex_);
vk::UniquePipelineCache cache_;
bool is_valid_ = false;

std::shared_ptr<fml::Mapping> CopyPipelineCacheData() const;
Expand Down