| Flutter Impeller |

Public Member Functions | Static Public Member Functions | Friends | List of all members
impeller::PipelineVK Class Referencefinal

`#include <pipeline_vk.h>`

Inheritance diagram for impeller::PipelineVK:

## Public Member Functions
| ~PipelineVK () override
vk::Pipeline | GetPipeline () const
const vk::PipelineLayout & | GetPipelineLayout () const
const vk::DescriptorSetLayout & | GetDescriptorSetLayout () const
std::shared_ptr< PipelineVK > | CreateVariantForImmutableSamplers (const std::shared_ptr< SamplerVK > &immutable_sampler) const
Public Member Functions inherited from impeller::Pipeline< PipelineDescriptor >
virtual | ~Pipeline ()
virtual bool | IsValid () const=0
const PipelineDescriptor & | GetDescriptor () const
| Get the descriptor that was responsible for creating this pipeline. It may be copied and modified to create a pipeline variant. More...
PipelineFuture< PipelineDescriptor > | CreateVariant (bool async, std::function< void(PipelineDescriptor &desc)> descriptor_callback) const

## Static Public Member Functions
static std::unique_ptr< PipelineVK > | Create (const PipelineDescriptor &desc, const std::shared_ptr< DeviceHolderVK > &device_holder, const std::weak_ptr< PipelineLibrary > &weak_library, std::shared_ptr< SamplerVK > immutable_sampler={})
Static Public Member Functions inherited from impeller::BackendCast< PipelineVK, Pipeline< PipelineDescriptor > >
static PipelineVK & | Cast (Pipeline< PipelineDescriptor > &base)
static const PipelineVK & | Cast (const Pipeline< PipelineDescriptor > &base)
static PipelineVK * | Cast (Pipeline< PipelineDescriptor > *base)
static const PipelineVK * | Cast (const Pipeline< PipelineDescriptor > *base)

## Friends
class | PipelineLibraryVK

## Additional Inherited Members
Protected Member Functions inherited from impeller::Pipeline< PipelineDescriptor >
| Pipeline (std::weak_ptr< PipelineLibrary > library, PipelineDescriptor desc)
Protected Attributes inherited from impeller::Pipeline< PipelineDescriptor >
const std::weak_ptr< PipelineLibrary > | library_
const PipelineDescriptor | desc_

## Detailed Description

Definition at line 28 of file pipeline_vk.h.

## Constructor & Destructor Documentation

## ◆ ~PipelineVK()

impeller::PipelineVK::~PipelineVK | ( |  | ) |
| override

Definition at line 525 of file pipeline_vk.cc.

525 {
526 if (auto device = device_holder_.lock(); !device) {
527 descriptor_set_layout_.release();
528 layout_.release();
529 render_pass_.release();
530 pipeline_.release();
531 }
532 }

## Member Function Documentation

## ◆ Create()

std::unique_ptr< PipelineVK > impeller::PipelineVK::Create | ( | const PipelineDescriptor & | desc,
|  | const std::shared_ptr< DeviceHolderVK > & | device_holder,
|  | const std::weak_ptr< PipelineLibrary > & | weak_library,
|  | std::shared_ptr< SamplerVK > | immutable_sampler = `{}`
| ) |  |
| static

Definition at line 449 of file pipeline_vk.cc.

453 {
454 TRACE_EVENT0("flutter", "PipelineVK::Create");
455
456 auto library = weak_library.lock();
457
458 if (!device_holder || !library) {
459 return nullptr;
460 }
461
462 const auto& pso_cache = PipelineLibraryVK::Cast(*library).GetPSOCache();
463
464 fml::StatusOr<vk::UniqueDescriptorSetLayout> descs_layout =
465 MakeDescriptorSetLayout(desc, device_holder, immutable_sampler);
466 if (!descs_layout.ok()) {
467 return nullptr;
468 }
469
470 fml::StatusOr<vk::UniquePipelineLayout> pipeline_layout =
471 MakePipelineLayout(desc, device_holder, descs_layout.value().get());
472 if (!pipeline_layout.ok()) {
473 return nullptr;
474 }
475
476 vk::UniqueRenderPass render_pass =
477 CreateCompatRenderPassForPipeline(device_holder->GetDevice(), desc);
478 if (!render_pass) {
479 VALIDATION_LOG << "Could not create render pass for pipeline.";
480 return nullptr;
481 }
482
483 fml::StatusOr<vk::UniquePipeline> pipeline =
484 MakePipeline(desc, device_holder, pso_cache,
485 pipeline_layout.value().get(), render_pass.get());
486 if (!pipeline.ok()) {
487 return nullptr;
488 }
489
490 auto pipeline_vk = std::unique_ptr<PipelineVK>(new PipelineVK(
491 device_holder, //
492 library, //
493 desc, //
494 std::move(pipeline.value()), //
495 std::move(render_pass), //
496 std::move(pipeline_layout.value()), //
497 std::move(descs_layout.value()), //
498 std::move(immutable_sampler) //
499 ));
500 if (!pipeline_vk->IsValid()) {
501 VALIDATION_LOG << "Could not create a valid pipeline.";
502 return nullptr;
503 }
504 return pipeline_vk;
505 }

References impeller::BackendCast< PipelineLibraryVK, PipelineLibrary >::Cast(), impeller::CreateCompatRenderPassForPipeline(), impeller::PipelineLibraryVK::GetPSOCache(), and VALIDATION_LOG.

Referenced by CreateVariantForImmutableSamplers().

## ◆ CreateVariantForImmutableSamplers()

std::shared_ptr< PipelineVK > impeller::PipelineVK::CreateVariantForImmutableSamplers | ( | const std::shared_ptr< SamplerVK > & | immutable_sampler | ) | const

Definition at line 550 of file pipeline_vk.cc.

551 {
552 if (!immutable_sampler) {
553 return nullptr;
554 }
555 auto cache_key = ImmutableSamplerKeyVK{*immutable_sampler};
556 Lock lock(immutable_sampler_variants_mutex_);
557 auto found = immutable_sampler_variants_.find(cache_key);
558 if (found != immutable_sampler_variants_.end()) {
559 return found->second;
560 }
561 auto device_holder = device_holder_.lock();
562 if (!device_holder) {
563 return nullptr;
564 }
565 return (immutable_sampler_variants_[cache_key] =
566 Create(desc_, device_holder, library_, immutable_sampler));
567 }

References Create(), impeller::Pipeline< PipelineDescriptor >::desc_, and impeller::Pipeline< PipelineDescriptor >::library_.

## ◆ GetDescriptorSetLayout()

const vk::DescriptorSetLayout & impeller::PipelineVK::GetDescriptorSetLayout | ( |  | ) | const

Definition at line 546 of file pipeline_vk.cc.

546 {
547 return *descriptor_set_layout_;
548 }

## ◆ GetPipeline()

vk::Pipeline impeller::PipelineVK::GetPipeline | ( |  | ) | const

Definition at line 538 of file pipeline_vk.cc.

538 {
539 return *pipeline_;
540 }

## ◆ GetPipelineLayout()

const vk::PipelineLayout & impeller::PipelineVK::GetPipelineLayout | ( |  | ) | const

Definition at line 542 of file pipeline_vk.cc.

542 {
543 return *layout_;
544 }

## Friends And Related Function Documentation

## ◆ PipelineLibraryVK

friend class PipelineLibraryVK
| friend

Definition at line 51 of file pipeline_vk.h.

The documentation for this class was generated from the following files:

- impeller/renderer/backend/vulkan/pipeline_vk.h
- impeller/renderer/backend/vulkan/pipeline_vk.cc

impeller::CreateCompatRenderPassForPipeline
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(const vk::Device &device, const PipelineDescriptor &desc)
Definition: pipeline_vk.cc:126
impeller::PipelineVK::Create
static std::unique_ptr< PipelineVK > Create(const PipelineDescriptor &desc, const std::shared_ptr< DeviceHolderVK > &device_holder, const std::weak_ptr< PipelineLibrary > &weak_library, std::shared_ptr< SamplerVK > immutable_sampler={})
Definition: pipeline_vk.cc:449
impeller::PipelineLibraryVK::GetPSOCache
const std::shared_ptr< PipelineCacheVK > & GetPSOCache() const
Definition: pipeline_library_vk.cc:294
impeller::Pipeline< PipelineDescriptor >::desc_
const PipelineDescriptor desc_
Definition: pipeline.h:71
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::BackendCast< PipelineLibraryVK, PipelineLibrary >::Cast
static PipelineLibraryVK & Cast(PipelineLibrary &base)
Definition: backend_cast.h:13
impeller::Pipeline< PipelineDescriptor >::library_
const std::weak_ptr< PipelineLibrary > library_
Definition: pipeline.h:69