Flutter Engine
The Flutter Engine
lazy_drawable_holder.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_LAZY_DRAWABLE_HOLDER_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_LAZY_DRAWABLE_HOLDER_H_
7
8#include <Metal/Metal.h>
9
10#include <future>
13
14@protocol CAMetalDrawable;
15@class CAMetalLayer;
16
17namespace impeller {
18
19/// @brief Create a deferred drawable from a CAMetalLayer.
20std::shared_future<id<CAMetalDrawable>> GetDrawableDeferred(
21 CAMetalLayer* layer);
22
23/// @brief Create a TextureMTL from a deferred drawable.
24///
25/// This function is safe to call multiple times and will only call
26/// nextDrawable once.
27std::shared_ptr<TextureMTL> CreateTextureFromDrawableFuture(
28 TextureDescriptor desc,
29 const std::shared_future<id<CAMetalDrawable>>& drawble_future);
30
31} // namespace impeller
32
33#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_LAZY_DRAWABLE_HOLDER_H_
std::shared_ptr< TextureMTL > CreateTextureFromDrawableFuture(TextureDescriptor desc, const std::shared_future< id< CAMetalDrawable > > &drawble_future)
Create a TextureMTL from a deferred drawable.
std::shared_future< id< CAMetalDrawable > > GetDrawableDeferred(CAMetalLayer *layer)
Create a deferred drawable from a CAMetalLayer.