blob: 1a73380b7a6a1a5cc0dd5f020f920e605882eaf4 [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_IMPELLER_SHADER_ARCHIVE_MULTI_ARCH_SHADER_ARCHIVE_H_
#define FLUTTER_IMPELLER_SHADER_ARCHIVE_MULTI_ARCH_SHADER_ARCHIVE_H_
#include <map>
#include <memory>
#include "flutter/fml/macros.h"
#include "flutter/fml/mapping.h"
#include "impeller/shader_archive/shader_archive.h"
#include "impeller/shader_archive/shader_archive_types.h"
namespace impeller {
class MultiArchShaderArchive {
public:
static std::shared_ptr<ShaderArchive> CreateArchiveFromMapping(
const std::shared_ptr<const fml::Mapping>& mapping,
ArchiveRenderingBackend backend);
explicit MultiArchShaderArchive(
const std::shared_ptr<const fml::Mapping>& mapping);
~MultiArchShaderArchive();
std::shared_ptr<const fml::Mapping> GetArchive(
ArchiveRenderingBackend backend) const;
std::shared_ptr<ShaderArchive> GetShaderArchive(
ArchiveRenderingBackend backend) const;
bool IsValid() const;
private:
std::map<ArchiveRenderingBackend, std::shared_ptr<const fml::Mapping>>
backend_mappings_;
bool is_valid_ = false;
MultiArchShaderArchive(const MultiArchShaderArchive&) = delete;
MultiArchShaderArchive& operator=(const MultiArchShaderArchive&) = delete;
};
} // namespace impeller
#endif // FLUTTER_IMPELLER_SHADER_ARCHIVE_MULTI_ARCH_SHADER_ARCHIVE_H_