| 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
PipelineKey | GetPipelineKey () const
Public Member Functions inherited from impeller::Pipeline< PipelineDescriptor >
virtual | ~Pipeline ()
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, const 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, PipelineKey pipeline_key, 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, const PipelineDescriptor &desc)
Protected Attributes inherited from impeller::Pipeline< PipelineDescriptor >
const std::weak_ptr< PipelineLibrary > | library_
const PipelineDescriptor | desc_

## Detailed Description

Definition at line 25 of file pipeline_vk.h.

## Constructor & Destructor Documentation

## ◆ ~PipelineVK()

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

Definition at line 545 of file pipeline_vk.cc.

545 {
546 if (auto device = device_holder_.lock(); !device) {
547 descriptor_set_layout_.release();
548 layout_.release();
549 render_pass_.release();
550 pipeline_.release();
551 }
552 }

## 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,
|  | PipelineKey | pipeline_key,
|  | std::shared_ptr< SamplerVK > | immutable_sampler = `{}`
| ) |  |
| static

Definition at line 464 of file pipeline_vk.cc.

469 {
470 TRACE_EVENT1("flutter", "PipelineVK::Create", "Name", desc.GetLabel().data());
471
472 auto library = weak_library.lock();
473
474 if (!device_holder || !library) {
475 return nullptr;
476 }
477
478 const auto& pso_cache = PipelineLibraryVK::Cast(*library).GetPSOCache();
479
480 fml::StatusOr<vk::UniqueDescriptorSetLayout> descs_layout =
481 MakeDescriptorSetLayout(desc, device_holder, immutable_sampler);
482 if (!descs_layout.ok()) {
483 return nullptr;
484 }
485
486 fml::StatusOr<vk::UniquePipelineLayout> pipeline_layout =
487 MakePipelineLayout(desc, device_holder, descs_layout.value().get());
488 if (!pipeline_layout.ok()) {
489 return nullptr;
490 }
491
492 vk::UniqueRenderPass render_pass =
493 CreateCompatRenderPassForPipeline(device_holder->GetDevice(), desc);
494 if (!render_pass) {
495 VALIDATION_LOG << "Could not create render pass for pipeline.";
496 return nullptr;
497 }
498
499 fml::StatusOr<vk::UniquePipeline> pipeline =
500 MakePipeline(desc, device_holder, pso_cache,
501 pipeline_layout.value().get(), render_pass.get());
502 if (!pipeline.ok()) {
503 return nullptr;
504 }
505
506 // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
507 auto pipeline_vk = std::unique_ptr<PipelineVK>(new PipelineVK(
508 device_holder, //
509 library, //
510 desc, //
511 std::move(pipeline.value()), //
512 std::move(render_pass), //
513 std::move(pipeline_layout.value()), //
514 std::move(descs_layout.value()), //
515 pipeline_key, //
516 std::move(immutable_sampler) //
517 ));
518 if (!pipeline_vk->IsValid()) {
519 VALIDATION_LOG << "Could not create a valid pipeline.";
520 return nullptr;
521 }
522 return pipeline_vk;
523 }
impeller::BackendCast< PipelineLibraryVK, PipelineLibrary >::Cast
static PipelineLibraryVK & Cast(PipelineLibrary &base)
Definition: backend_cast.h:13
impeller::PipelineLibraryVK::GetPSOCache
const std::shared_ptr< PipelineCacheVK > & GetPSOCache() const
Definition: pipeline_library_vk.cc:298
impeller::CreateCompatRenderPassForPipeline
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(const vk::Device &device, const PipelineDescriptor &desc)
Definition: pipeline_vk.cc:128
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::BackendCast< PipelineLibraryVK, PipelineLibrary >::Cast(), impeller::CreateCompatRenderPassForPipeline(), impeller::PipelineDescriptor::GetLabel(), 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 570 of file pipeline_vk.cc.

571 {
572 if (!immutable_sampler) {
573 return nullptr;
574 }
575 auto cache_key = ImmutableSamplerKeyVK{*immutable_sampler};
576 Lock lock(immutable_sampler_variants_mutex_);
577 auto found = immutable_sampler_variants_.find(cache_key);
578 if (found != immutable_sampler_variants_.end()) {
579 return found->second;
580 }
581 auto device_holder = device_holder_.lock();
582 if (!device_holder) {
583 return nullptr;
584 }
585 // Note: immutable sampler variant of a pipeline is the negation of the
586 // existing pipeline key. This keeps the descriptors separate.
587 return (immutable_sampler_variants_[cache_key] =
588 Create(desc_, device_holder, library_, -1 * pipeline_key_,
589 immutable_sampler));
590 }
impeller::Pipeline< PipelineDescriptor >::library_
const std::weak_ptr< PipelineLibrary > library_
Definition: pipeline.h:73
impeller::Pipeline< PipelineDescriptor >::desc_
const PipelineDescriptor desc_
Definition: pipeline.h:75
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, PipelineKey pipeline_key, std::shared_ptr< SamplerVK > immutable_sampler={})
Definition: pipeline_vk.cc:464

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

## ◆ GetDescriptorSetLayout()

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

Definition at line 566 of file pipeline_vk.cc.

566 {
567 return *descriptor_set_layout_;
568 }

## ◆ GetPipeline()

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

Definition at line 558 of file pipeline_vk.cc.

558 {
559 return *pipeline_;
560 }

## ◆ GetPipelineKey()

PipelineKey impeller::PipelineVK::GetPipelineKey | ( |  | ) | const
| inline

Definition at line 48 of file pipeline_vk.h.

48 { return pipeline_key_; }

## ◆ GetPipelineLayout()

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

Definition at line 562 of file pipeline_vk.cc.

562 {
563 return *layout_;
564 }

## 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