| Flutter Impeller |

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
5 #include "impeller/renderer/backend/metal/texture_wrapper_mtl.h"
6
7 #include <Metal/Metal.h>
8
9 #include "impeller/renderer/backend/metal/formats_mtl.h"
10 #include "impeller/renderer/backend/metal/texture_mtl.h"
11
12 namespace impeller {
13
14 std::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
impeller::TextureMTL::Wrapper
static std::shared_ptr< TextureMTL > Wrapper(TextureDescriptor desc, id< MTLTexture > texture, std::function< void()> deletion_proc=nullptr)
Definition: texture_mtl.mm:42
formats_mtl.h
impeller
Definition: allocation.cc:12
impeller::FromMTLPixelFormat
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition: formats_mtl.h:22
impeller::WrapTextureMTL
std::shared_ptr< Texture > WrapTextureMTL(TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc=nullptr)
Definition: texture_wrapper_mtl.mm:14
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
texture_mtl.h
texture_wrapper_mtl.h