forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpipeline_library.cc
More file actions
35 lines (28 loc) · 1.11 KB
/
pipeline_library.cc
File metadata and controls
35 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "impeller/renderer/pipeline_library.h"
namespace impeller {
PipelineLibrary::PipelineLibrary() = default;
PipelineLibrary::~PipelineLibrary() = default;
PipelineFuture<PipelineDescriptor> PipelineLibrary::GetPipeline(
std::optional<PipelineDescriptor> descriptor) {
if (descriptor.has_value()) {
return GetPipeline(descriptor.value());
}
auto promise = std::make_shared<
std::promise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
promise->set_value(nullptr);
return {descriptor, promise->get_future()};
}
PipelineFuture<ComputePipelineDescriptor> PipelineLibrary::GetPipeline(
std::optional<ComputePipelineDescriptor> descriptor) {
if (descriptor.has_value()) {
return GetPipeline(descriptor.value());
}
auto promise = std::make_shared<
std::promise<std::shared_ptr<Pipeline<ComputePipelineDescriptor>>>>();
promise->set_value(nullptr);
return {descriptor, promise->get_future()};
}
} // namespace impeller