Make sure only valid pipeline futures are awaited upon.

This commit is contained in:
Chinmay Garde 2021-08-18 16:35:40 -07:00 committed by Dan Field
parent 37aa63cf06
commit d279337bdb
3 changed files with 14 additions and 3 deletions

View File

@ -12,6 +12,7 @@ namespace impeller {
struct Paint {
Color color;
Scalar stroke_width = 0.0;
};
} // namespace impeller

View File

@ -63,10 +63,21 @@ class PipelineT {
context,
Builder::MakeDefaultPipelineDescriptor(context))) {}
std::shared_ptr<Pipeline> WaitAndGet() { return pipeline_future_.get(); }
std::shared_ptr<Pipeline> WaitAndGet() {
if (did_wait_) {
return pipeline_;
}
did_wait_ = true;
if (pipeline_future_.valid()) {
pipeline_ = pipeline_future_.get();
}
return pipeline_;
}
private:
PipelineFuture pipeline_future_;
std::shared_ptr<Pipeline> pipeline_;
bool did_wait_ = false;
FML_DISALLOW_COPY_AND_ASSIGN(PipelineT);
};

View File

@ -31,8 +31,7 @@ bool EntityRendererImpl::RenderEntity(const Surface& surface,
}
if (entity.HasContents()) {
using CurrentPipeline = decltype(solid_fill_pipeline_)::element_type;
using VS = CurrentPipeline::VertexShader;
using VS = SolidFillPipeline::VertexShader;
Command cmd;
cmd.pipeline = solid_fill_pipeline_->WaitAndGet();