83 if (!
IsValid() || !contents || is_wrapped_ || is_drawable_) {
90 if (
length != desc.GetByteSizeOfBaseMipLevel()) {
95 MTLRegionMake2D(0u, 0u, desc.size.width, desc.size.height);
96 [aquire_proc_() replaceRegion:region
100 bytesPerRow:desc.GetBytesPerRow()
101 bytesPerImage:desc.GetByteSizeOfBaseMipLevel()
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
id< MTLTexture > GetMTLTexture() const
TextureMTL(TextureDescriptor desc, const AcquireTextureProc &aquire_proc, bool wrapped=false, bool drawable=false)
bool OnSetContents(const uint8_t *contents, size_t length, size_t slice) override
bool IsDrawable() const
Whether or not this texture is wrapping a Metal drawable.
bool IsValid() const override
std::function< id< MTLTexture >()> AcquireTextureProc
This callback needs to always return the same texture when called multiple times.
void SetLabel(std::string_view label) override
bool GenerateMipmap(id< MTLBlitCommandEncoder > encoder)
ISize GetSize() const override
static std::shared_ptr< TextureMTL > Wrapper(TextureDescriptor desc, id< MTLTexture > texture, std::function< void()> deletion_proc=nullptr)
static std::shared_ptr< TextureMTL > Create(TextureDescriptor desc, id< MTLTexture > texture)
const TextureDescriptor & GetTextureDescriptor() const
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...