| Flutter Impeller |

Public Member Functions | List of all members
impeller::interop::FragmentProgram Class Referencefinal

`#include <fragment_program.h>`

Inheritance diagram for impeller::interop::FragmentProgram:

## Public Member Functions
| FragmentProgram (const std::shared_ptr< fml::Mapping > &mapping)
| ~FragmentProgram ()
| FragmentProgram (const FragmentProgram &)=delete
FragmentProgram & | operator= (const FragmentProgram &)=delete
bool | IsValid () const
std::shared_ptr< RuntimeStage > | FindRuntimeStage (RuntimeStageBackend backend) const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (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
17 auto stages = RuntimeStage::DecodeRuntimeStages(data);
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 }
impeller::RuntimeStage::DecodeRuntimeStages
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:62
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:68
VALIDATION_LOG
#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) {
56 return FindRuntimeStage(RuntimeStageBackend::kOpenGLES);
57 }
58 auto found = stages_.find(backend);
59 if (found == stages_.end()) {
60 VALIDATION_LOG << "Could not find runtime shader for backend: "
61 << RuntimeStageBackendToString(backend)
62 << ". Shaders were packaged for "
63 << AvailableStagesAsString(GetAvailableStages())
64 << ". Check your shader compiler options.";
65 return nullptr;
66 }
67 return found->second;
68 }
impeller::interop::FragmentProgram::FindRuntimeStage
std::shared_ptr< RuntimeStage > FindRuntimeStage(RuntimeStageBackend backend) const
Definition: fragment_program.cc:53
impeller::interop::RuntimeStageBackendToString
const char * RuntimeStageBackendToString(RuntimeStageBackend backend)
Definition: fragment_program.cc:70
impeller::interop::AvailableStagesAsString
static std::string AvailableStagesAsString(const std::set< RuntimeStageBackend > &stages)
Definition: fragment_program.cc:39
impeller::RuntimeStageBackend::kOpenGLES
@ kOpenGLES
impeller::RuntimeStageBackend::kOpenGLES3
@ kOpenGLES3

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

Referenced by 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:

- impeller/toolkit/interop/fragment_program.h
- impeller/toolkit/interop/fragment_program.cc