Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Friends | List of all members
impeller::PipelineVK Class Referencefinal

#include <pipeline_vk.h>

Inheritance diagram for impeller::PipelineVK:
impeller::Pipeline< PipelineDescriptor > impeller::BackendCast< PipelineVK, Pipeline< PipelineDescriptor > >

Public Member Functions

 ~PipelineVK () override
 
vk::Pipeline GetPipeline () const
 
const vk::PipelineLayout & GetPipelineLayout () const
 
const vk::DescriptorSetLayout & GetDescriptorSetLayout () const
 
std::shared_ptr< PipelineVKCreateVariantForImmutableSamplers (const std::shared_ptr< SamplerVK > &immutable_sampler) const
 
- Public Member Functions inherited from impeller::Pipeline< PipelineDescriptor >
virtual ~Pipeline ()
 
const PipelineDescriptorGetDescriptor () const
 Get the descriptor that was responsible for creating this pipeline. It may be copied and modified to create a pipeline variant.
 
PipelineFuture< PipelineDescriptorCreateVariant (std::function< void(PipelineDescriptor &desc)> descriptor_callback) const
 

Static Public Member Functions

static std::unique_ptr< PipelineVKCreate (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 PipelineVKCast (Pipeline< PipelineDescriptor > &base)
 
static const PipelineVKCast (const Pipeline< PipelineDescriptor > &base)
 
static PipelineVKCast (Pipeline< PipelineDescriptor > *base)
 
static const PipelineVKCast (const Pipeline< PipelineDescriptor > *base)
 

Private Member Functions

bool IsValid () const override
 

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< PipelineLibrarylibrary_
 
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}
VkDevice device
Definition main.cc:53

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
465 MakeDescriptorSetLayout(desc, device_holder, immutable_sampler);
466 if (!descs_layout.ok()) {
467 return nullptr;
468 }
469
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
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}
const T & value() const
Definition status_or.h:77
bool ok() const
Definition status_or.h:75
static PipelineLibraryVK & Cast(PipelineLibrary &base)
const std::shared_ptr< PipelineCacheVK > & GetPSOCache() const
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(const vk::Device &device, const PipelineDescriptor &desc)
#define TRACE_EVENT0(category_group, name)
#define VALIDATION_LOG
Definition validation.h:73

◆ 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}
static sk_sp< Effect > Create()
const std::weak_ptr< PipelineLibrary > library_
Definition pipeline.h:68
const PipelineDescriptor desc_
Definition pipeline.h:70

◆ 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}

◆ IsValid()

bool impeller::PipelineVK::IsValid ( ) const
overrideprivatevirtual

Implements impeller::Pipeline< PipelineDescriptor >.

Definition at line 534 of file pipeline_vk.cc.

534 {
535 return is_valid_;
536}

Friends And Related Symbol 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: