Flutter Impeller
impeller::ShaderArchive Class Reference

#include <shader_archive.h>

Public Member Functions

 ShaderArchive (ShaderArchive &&)
 
 ~ShaderArchive ()
 
bool IsValid () const
 
size_t GetShaderCount () const
 
std::shared_ptr< fml::Mapping > GetMapping (ArchiveShaderType type, std::string name) const
 
size_t IterateAllShaders (const std::function< bool(ArchiveShaderType type, const std::string &name, const std::shared_ptr< fml::Mapping > &mapping)> &) const
 

Detailed Description

Definition at line 21 of file shader_archive.h.

Constructor & Destructor Documentation

◆ ShaderArchive()

impeller::ShaderArchive::ShaderArchive ( ShaderArchive &&  )
default

◆ ~ShaderArchive()

impeller::ShaderArchive::~ShaderArchive ( )
default

Member Function Documentation

◆ GetMapping()

std::shared_ptr< fml::Mapping > impeller::ShaderArchive::GetMapping ( ArchiveShaderType  type,
std::string  name 
) const

Definition at line 74 of file shader_archive.cc.

76  {
77  ShaderKey key;
78  key.type = type;
79  key.name = std::move(name);
80  auto found = shaders_.find(key);
81  return found == shaders_.end() ? nullptr : found->second;
82 }

◆ GetShaderCount()

size_t impeller::ShaderArchive::GetShaderCount ( ) const

Definition at line 70 of file shader_archive.cc.

70  {
71  return shaders_.size();
72 }

◆ IsValid()

bool impeller::ShaderArchive::IsValid ( ) const

Definition at line 66 of file shader_archive.cc.

66  {
67  return is_valid_;
68 }

◆ IterateAllShaders()

size_t impeller::ShaderArchive::IterateAllShaders ( const std::function< bool(ArchiveShaderType type, const std::string &name, const std::shared_ptr< fml::Mapping > &mapping)> &  callback) const

Definition at line 84 of file shader_archive.cc.

88  {
89  if (!IsValid() || !callback) {
90  return 0u;
91  }
92  size_t count = 0u;
93  for (const auto& shader : shaders_) {
94  count++;
95  if (!callback(shader.first.type, shader.first.name, shader.second)) {
96  break;
97  }
98  }
99  return count;
100 }

The documentation for this class was generated from the following files:
impeller::ShaderArchive::IsValid
bool IsValid() const
Definition: shader_archive.cc:66