Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
texture_wrapper_mtl.mm
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
6
7#include <Metal/Metal.h>
8
11
12namespace impeller {
13
14std::shared_ptr<Texture> WrapTextureMTL(TextureDescriptor desc,
15 const void* mtl_texture,
16 std::function<void()> deletion_proc) {
17 auto texture = (__bridge id<MTLTexture>)mtl_texture;
18 desc.format = FromMTLPixelFormat(texture.pixelFormat);
19 return TextureMTL::Wrapper(desc, texture, std::move(deletion_proc));
20}
21
22} // namespace impeller
static std::shared_ptr< TextureMTL > Wrapper(TextureDescriptor desc, id< MTLTexture > texture, std::function< void()> deletion_proc=nullptr)
FlTexture * texture
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition formats_mtl.h:23
std::shared_ptr< Texture > WrapTextureMTL(TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc=nullptr)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...