Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::interop::FragmentProgram Class Referencefinal

#include <fragment_program.h>

Inheritance diagram for impeller::interop::FragmentProgram:
impeller::interop::Object< FragmentProgram, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerFragmentProgram)> impeller::interop::ObjectBase

Public Member Functions

 FragmentProgram (const std::shared_ptr< fml::Mapping > &mapping)
 
 ~FragmentProgram ()
 
 FragmentProgram (const FragmentProgram &)=delete
 
FragmentProgramoperator= (const FragmentProgram &)=delete
 
bool IsValid () const
 
std::shared_ptr< RuntimeStageFindRuntimeStage (RuntimeStageBackend backend) const
 
- Public Member Functions inherited from impeller::interop::ObjectBase
 ObjectBase ()=default
 
virtual ~ObjectBase ()=default
 
 ObjectBase (const ObjectBase &)=delete
 
 ObjectBase (ObjectBase &&)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
ObjectBaseoperator= (ObjectBase &&)=delete
 
void Retain ()
 
void Release ()
 
uint64_t GetRefCountForTests () const
 

Additional Inherited Members

- Public Types inherited from impeller::interop::Object< FragmentProgram, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerFragmentProgram)>
using InteropClass = FragmentProgram
 
using InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerFragmentProgram)
 
- Static Public Member Functions inherited from impeller::interop::ObjectBase
static void SafeRetain (void *ptr)
 
static void SafeRelease (void *ptr)
 

Detailed Description

Definition at line 15 of file fragment_program.h.

Constructor & Destructor Documentation

◆ FragmentProgram() [1/2]

impeller::interop::FragmentProgram::FragmentProgram ( const std::shared_ptr< fml::Mapping > &  mapping)
explicit

Definition at line 11 of file fragment_program.cc.

11 {
12 if (data == nullptr || data->GetSize() == 0) {
13 VALIDATION_LOG << "No data provided to create fragment program.";
14 return;
15 }
16
18 if (!stages.ok()) {
19 VALIDATION_LOG << "Failed to decode runtime stages: " << stages.status();
20 return;
21 }
22
23 for (const auto& stage : stages.value()) {
24 if (auto data = stage.second) {
25 stages_[stage.first] = std::move(data);
26 }
27 }
28
29 if (stages_.empty()) {
30 VALIDATION_LOG << "No valid runtime stages present in fragment program.";
31 return;
32 }
33
34 is_valid_ = true;
35}
static absl::StatusOr< Map > DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
int32_t value
std::shared_ptr< const fml::Mapping > data
#define VALIDATION_LOG
Definition validation.h:91

References data, impeller::RuntimeStage::DecodeRuntimeStages(), and VALIDATION_LOG.

◆ ~FragmentProgram()

impeller::interop::FragmentProgram::~FragmentProgram ( )
default

◆ FragmentProgram() [2/2]

impeller::interop::FragmentProgram::FragmentProgram ( const FragmentProgram )
delete

Member Function Documentation

◆ FindRuntimeStage()

std::shared_ptr< RuntimeStage > impeller::interop::FragmentProgram::FindRuntimeStage ( RuntimeStageBackend  backend) const

Definition at line 57 of file fragment_program.cc.

58 {
59 if (backend == RuntimeStageBackend::kOpenGLES3) {
61 }
62 auto found = stages_.find(backend);
63 if (found == stages_.end()) {
64 VALIDATION_LOG << "Could not find runtime shader for backend: "
66 << ". Shaders were packaged for "
67 << AvailableStagesAsString(GetAvailableStages())
68 << ". Check your shader compiler options.";
69 return nullptr;
70 }
71 return found->second;
72}
std::shared_ptr< RuntimeStage > FindRuntimeStage(RuntimeStageBackend backend) const
const char * RuntimeStageBackendToString(RuntimeStageBackend backend)
static std::string AvailableStagesAsString(const std::set< RuntimeStageBackend > &stages)

References impeller::interop::AvailableStagesAsString(), FindRuntimeStage(), impeller::kOpenGLES, impeller::kOpenGLES3, impeller::interop::RuntimeStageBackendToString(), and VALIDATION_LOG.

Referenced by FindRuntimeStage(), impeller::interop::ColorSource::MakeFragmentProgram(), and impeller::interop::ImageFilter::MakeFragmentProgram().

◆ IsValid()

bool impeller::interop::FragmentProgram::IsValid ( ) const

Definition at line 39 of file fragment_program.cc.

39 {
40 return is_valid_;
41}

◆ operator=()

FragmentProgram & impeller::interop::FragmentProgram::operator= ( const FragmentProgram )
delete

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