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 1 commit
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
Prev Previous commit
Next Next commit
Tweak code
  • Loading branch information
ColdPaleLight committed Nov 8, 2022
commit cf3a26c5f2c64a17765998c1ca85bf32bbc132b6
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/pipeline_library_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool PipelineLibraryGLES::IsValid() const {
PipelineFuture<PipelineDescriptor> PipelineLibraryGLES::GetPipeline(
PipelineDescriptor descriptor) {
if (auto found = pipelines_.find(descriptor); found != pipelines_.end()) {
return {descriptor, found->second};
return found->second;
}

if (!reactor_) {
Expand All @@ -200,7 +200,7 @@ PipelineFuture<PipelineDescriptor> PipelineLibraryGLES::GetPipeline(
std::promise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
auto pipeline_future =
PipelineFuture<PipelineDescriptor>{descriptor, promise->get_future()};
pipelines_[descriptor] = pipeline_future.future;
pipelines_[descriptor] = pipeline_future;
auto weak_this = weak_from_this();

auto result = reactor_->AddOperation(
Expand Down
8 changes: 4 additions & 4 deletions impeller/renderer/backend/metal/pipeline_library_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
PipelineFuture<PipelineDescriptor> PipelineLibraryMTL::GetPipeline(
PipelineDescriptor descriptor) {
if (auto found = pipelines_.find(descriptor); found != pipelines_.end()) {
return {descriptor, found->second};
return found->second;
}

if (!IsValid()) {
Expand All @@ -102,7 +102,7 @@
std::promise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
auto pipeline_future =
PipelineFuture<PipelineDescriptor>{descriptor, promise->get_future()};
pipelines_[descriptor] = pipeline_future.future;
pipelines_[descriptor] = pipeline_future;
auto weak_this = weak_from_this();

auto completion_handler =
Expand Down Expand Up @@ -141,7 +141,7 @@
ComputePipelineDescriptor descriptor) {
if (auto found = compute_pipelines_.find(descriptor);
found != compute_pipelines_.end()) {
return {descriptor, found->second};
return found->second;
}

if (!IsValid()) {
Expand All @@ -155,7 +155,7 @@
std::promise<std::shared_ptr<Pipeline<ComputePipelineDescriptor>>>>();
auto pipeline_future = PipelineFuture<ComputePipelineDescriptor>{
descriptor, promise->get_future()};
compute_pipelines_[descriptor] = pipeline_future.future;
compute_pipelines_[descriptor] = pipeline_future;
auto weak_this = weak_from_this();

auto completion_handler =
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PipelineFuture<PipelineDescriptor> PipelineLibraryVK::GetPipeline(
PipelineDescriptor descriptor) {
Lock lock(pipelines_mutex_);
if (auto found = pipelines_.find(descriptor); found != pipelines_.end()) {
return {descriptor, found->second};
return found->second;
}

if (!IsValid()) {
Expand All @@ -70,7 +70,7 @@ PipelineFuture<PipelineDescriptor> PipelineLibraryVK::GetPipeline(
std::promise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
auto pipeline_future =
PipelineFuture<PipelineDescriptor>{descriptor, promise->get_future()};
pipelines_[descriptor] = pipeline_future.future;
pipelines_[descriptor] = pipeline_future;

auto weak_this = weak_from_this();

Expand Down
6 changes: 0 additions & 6 deletions impeller/renderer/compute_pipeline_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,4 @@ class ComputePipelineDescriptor final
std::shared_ptr<const ShaderFunction> entrypoint_;
};

using ComputePipelineMap = std::unordered_map<
ComputePipelineDescriptor,
std::shared_future<std::shared_ptr<Pipeline<ComputePipelineDescriptor>>>,
ComparableHash<ComputePipelineDescriptor>,
ComparableEqual<ComputePipelineDescriptor>>;

} // namespace impeller
6 changes: 0 additions & 6 deletions impeller/renderer/pipeline_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,4 @@ class PipelineDescriptor final : public Comparable<PipelineDescriptor> {
PrimitiveType primitive_type_ = PrimitiveType::kTriangle;
};

using PipelineMap = std::unordered_map<
PipelineDescriptor,
std::shared_future<std::shared_ptr<Pipeline<PipelineDescriptor>>>,
ComparableHash<PipelineDescriptor>,
ComparableEqual<PipelineDescriptor>>;

} // namespace impeller
11 changes: 11 additions & 0 deletions impeller/renderer/pipeline_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ namespace impeller {

class Context;

using PipelineMap = std::unordered_map<PipelineDescriptor,
PipelineFuture<PipelineDescriptor>,
ComparableHash<PipelineDescriptor>,
ComparableEqual<PipelineDescriptor>>;

using ComputePipelineMap =
std::unordered_map<ComputePipelineDescriptor,
PipelineFuture<ComputePipelineDescriptor>,
ComparableHash<ComputePipelineDescriptor>,
ComparableEqual<ComputePipelineDescriptor>>;

class PipelineLibrary : public std::enable_shared_from_this<PipelineLibrary> {
public:
virtual ~PipelineLibrary();
Expand Down