Flutter Engine
 
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
19 for (const auto& stage : stages) {
20 if (auto data = stage.second) {
21 stages_[stage.first] = std::move(data);
22 }
23 }
24
25 if (stages_.empty()) {
26 VALIDATION_LOG << "No valid runtime stages present in fragment program.";
27 return;
28 }
29
30 is_valid_ = true;
31}
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
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 53 of file fragment_program.cc.

54 {
55 if (backend == RuntimeStageBackend::kOpenGLES3) {
57 }
58 auto found = stages_.find(backend);
59 if (found == stages_.end()) {
60 VALIDATION_LOG << "Could not find runtime shader for backend: "
62 << ". Shaders were packaged for "
63 << AvailableStagesAsString(GetAvailableStages())
64 << ". Check your shader compiler options.";
65 return nullptr;
66 }
67 return found->second;
68}
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 35 of file fragment_program.cc.

35 {
36 return is_valid_;
37}

◆ operator=()

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

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