| 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 ()
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 540 of file pipeline_vk.cc.

540 {
541 if (auto device = device_holder_.lock(); !device) {
542 descriptor_set_layout_.release();
543 layout_.release();
544 render_pass_.release();
545 pipeline_.release();
546 }
547 }

## 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 464 of file pipeline_vk.cc.

468 {
469 TRACE_EVENT1("flutter", "PipelineVK::Create", "Name", desc.GetLabel().data());
470
471 auto library = weak_library.lock();
472
473 if (!device_holder || !library) {
474 return nullptr;
475 }
476
477 const auto& pso_cache = PipelineLibraryVK::Cast(*library).GetPSOCache();
478
479 fml::StatusOr<vk::UniqueDescriptorSetLayout> descs_layout =
480 MakeDescriptorSetLayout(desc, device_holder, immutable_sampler);
481 if (!descs_layout.ok()) {
482 return nullptr;
483 }
484
485 fml::StatusOr<vk::UniquePipelineLayout> pipeline_layout =
486 MakePipelineLayout(desc, device_holder, descs_layout.value().get());
487 if (!pipeline_layout.ok()) {
488 return nullptr;
489 }
490
491 vk::UniqueRenderPass render_pass =
492 CreateCompatRenderPassForPipeline(device_holder->GetDevice(), desc);
493 if (!render_pass) {
494 VALIDATION_LOG << "Could not create render pass for pipeline.";
495 return nullptr;
496 }
497
498 fml::StatusOr<vk::UniquePipeline> pipeline =
499 MakePipeline(desc, device_holder, pso_cache,
500 pipeline_layout.value().get(), render_pass.get());
501 if (!pipeline.ok()) {
502 return nullptr;
503 }
504
505 auto pipeline_vk = std::unique_ptr<PipelineVK>(new PipelineVK(
506 device_holder, //
507 library, //
508 desc, //
509 std::move(pipeline.value()), //
510 std::move(render_pass), //
511 std::move(pipeline_layout.value()), //
512 std::move(descs_layout.value()), //
513 std::move(immutable_sampler) //
514 ));
515 if (!pipeline_vk->IsValid()) {
516 VALIDATION_LOG << "Could not create a valid pipeline.";
517 return nullptr;
518 }
519 return pipeline_vk;
520 }
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:300
impeller::CreateCompatRenderPassForPipeline
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(const vk::Device &device, const PipelineDescriptor &desc)
Definition: pipeline_vk.cc:127
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 565 of file pipeline_vk.cc.

566 {
567 if (!immutable_sampler) {
568 return nullptr;
569 }
570 auto cache_key = ImmutableSamplerKeyVK{*immutable_sampler};
571 Lock lock(immutable_sampler_variants_mutex_);
572 auto found = immutable_sampler_variants_.find(cache_key);
573 if (found != immutable_sampler_variants_.end()) {
574 return found->second;
575 }
576 auto device_holder = device_holder_.lock();
577 if (!device_holder) {
578 return nullptr;
579 }
580 return (immutable_sampler_variants_[cache_key] =
581 Create(desc_, device_holder, library_, immutable_sampler));
582 }
impeller::Pipeline< PipelineDescriptor >::library_
const std::weak_ptr< PipelineLibrary > library_
Definition: pipeline.h:70
impeller::Pipeline< PipelineDescriptor >::desc_
const PipelineDescriptor desc_
Definition: pipeline.h:72
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:464

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

## ◆ GetDescriptorSetLayout()

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

Definition at line 561 of file pipeline_vk.cc.

561 {
562 return *descriptor_set_layout_;
563 }

## ◆ GetPipeline()

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

Definition at line 553 of file pipeline_vk.cc.

553 {
554 return *pipeline_;
555 }

## ◆ GetPipelineLayout()

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

Definition at line 557 of file pipeline_vk.cc.

557 {
558 return *layout_;
559 }

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