| 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 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 }
impeller::RuntimeStage::DecodeRuntimeStages
static absl::StatusOr< Map > DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:143
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:69
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 57 of file fragment_program.cc.

58 {
59 if (backend == RuntimeStageBackend::kOpenGLES3) {
60 return FindRuntimeStage(RuntimeStageBackend::kOpenGLES);
61 }
62 auto found = stages_.find(backend);
63 if (found == stages_.end()) {
64 VALIDATION_LOG << "Could not find runtime shader for backend: "
65 << RuntimeStageBackendToString(backend)
66 << ". Shaders were packaged for "
67 << AvailableStagesAsString(GetAvailableStages())
68 << ". Check your shader compiler options.";
69 return nullptr;
70 }
71 return found->second;
72 }
impeller::interop::FragmentProgram::FindRuntimeStage
std::shared_ptr< RuntimeStage > FindRuntimeStage(RuntimeStageBackend backend) const
Definition: fragment_program.cc:57
impeller::interop::RuntimeStageBackendToString
const char * RuntimeStageBackendToString(RuntimeStageBackend backend)
Definition: fragment_program.cc:74
impeller::interop::AvailableStagesAsString
static std::string AvailableStagesAsString(const std::set< RuntimeStageBackend > &stages)
Definition: fragment_program.cc:43
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 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:

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