/* * Copyright 2021 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_graphite_MtlSharedContext_DEFINED #define skgpu_graphite_MtlSharedContext_DEFINED #include "src/gpu/graphite/SharedContext.h" #include "include/ports/SkCFObject.h" #include "include/gpu/graphite/mtl/MtlBackendContext.h" #include "src/gpu/graphite/mtl/MtlCaps.h" #import namespace skgpu { class MtlMemoryAllocator; } namespace skgpu::graphite { struct ContextOptions; class MtlSharedContext final : public SharedContext { public: static sk_sp Make(const MtlBackendContext&, const ContextOptions&); ~MtlSharedContext() override; skgpu::MtlMemoryAllocator* memoryAllocator() const { return fMemoryAllocator.get(); } id device() const { return fDevice.get(); } const MtlCaps& mtlCaps() const { return static_cast(*this->caps()); } std::unique_ptr makeResourceProvider(SingleOwner*) override; private: MtlSharedContext(sk_cfp>, sk_sp memoryAllocator, std::unique_ptr); sk_sp fMemoryAllocator; sk_cfp> fDevice; }; } // namespace skgpu::graphite #endif // skgpu_graphite_MtlSharedContext_DEFINED