Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
skgpu::graphite::MtlSharedContext Class Referencefinal

#include <MtlSharedContext.h>

Inheritance diagram for skgpu::graphite::MtlSharedContext:
skgpu::graphite::SharedContext SkRefCnt SkRefCntBase

Public Member Functions

 ~MtlSharedContext () override
 
skgpu::MtlMemoryAllocator * memoryAllocator () const
 
id< MTLDevice > device () const
 
const MtlCapsmtlCaps () const
 
std::unique_ptr< ResourceProvidermakeResourceProvider (SingleOwner *, uint32_t recorderID, size_t resourceBudget) override
 
- Public Member Functions inherited from skgpu::graphite::SharedContext
 ~SharedContext () override
 
const Capscaps () const
 
BackendApi backend () const
 
Protected isProtected () const
 
GlobalCacheglobalCache ()
 
const GlobalCacheglobalCache () const
 
const RendererProviderrendererProvider () const
 
ShaderCodeDictionaryshaderCodeDictionary ()
 
const ShaderCodeDictionaryshaderCodeDictionary () const
 
virtual std::unique_ptr< ResourceProvidermakeResourceProvider (SingleOwner *, uint32_t recorderID, size_t resourceBudget)=0
 
virtual bool isDeviceLost () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SharedContextMake (const MtlBackendContext &, const ContextOptions &)
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::SharedContext
 SharedContext (std::unique_ptr< const Caps >, BackendApi)
 

Detailed Description

Definition at line 27 of file MtlSharedContext.h.

Constructor & Destructor Documentation

◆ ~MtlSharedContext()

skgpu::graphite::MtlSharedContext::~MtlSharedContext ( )
override

Definition at line 59 of file MtlSharedContext.mm.

59 {
60 // need to clear out resources before the allocator (if any) is removed
62}

Member Function Documentation

◆ device()

id< MTLDevice > skgpu::graphite::MtlSharedContext::device ( ) const
inline

Definition at line 34 of file MtlSharedContext.h.

34{ return fDevice.get(); }

◆ Make()

sk_sp< skgpu::graphite::SharedContext > skgpu::graphite::MtlSharedContext::Make ( const MtlBackendContext context,
const ContextOptions options 
)
static

Definition at line 22 of file MtlSharedContext.mm.

23 {
24 if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
25 // no warning needed
26 } else {
27 SKGPU_LOG_E("Skia's Graphite backend no longer supports this OS version.");
28#ifdef SK_BUILD_FOR_IOS
29 SKGPU_LOG_E("Minimum supported version is iOS/tvOS 13.0.");
30#else
31 SKGPU_LOG_E("Minimum supported version is MacOS 10.15.");
32#endif
33 return nullptr;
34 }
35
36 sk_cfp<id<MTLDevice>> device = sk_ret_cfp((id<MTLDevice>)(context.fDevice.get()));
37
38 std::unique_ptr<const MtlCaps> caps(new MtlCaps(device.get(), options));
39
40 // TODO: Add memory allocator to context once we figure out synchronization
42 if (!memoryAllocator) {
43 SkDEBUGFAIL("No supplied Metal memory allocator and unable to create one internally.");
44 return nullptr;
45 }
46
47 return sk_sp<skgpu::graphite::SharedContext>(new MtlSharedContext(std::move(device),
48 std::move(memoryAllocator),
49 std::move(caps)));
50}
const char * options
#define SKGPU_LOG_E(fmt,...)
Definition: Log.h:38
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
static sk_sp< MtlMemoryAllocator > Make(id< MTLDevice >)
skgpu::MtlMemoryAllocator * memoryAllocator() const
id< MTLDevice > device() const
const Caps * caps() const
Definition: SharedContext.h:39

◆ makeResourceProvider()

std::unique_ptr< ResourceProvider > skgpu::graphite::MtlSharedContext::makeResourceProvider ( SingleOwner singleOwner,
uint32_t  recorderID,
size_t  resourceBudget 
)
overridevirtual

Implements skgpu::graphite::SharedContext.

Definition at line 64 of file MtlSharedContext.mm.

66 {
67 return std::unique_ptr<ResourceProvider>(new MtlResourceProvider(this,
68 singleOwner,
69 recorderID,
70 resourceBudget));
71}

◆ memoryAllocator()

skgpu::MtlMemoryAllocator * skgpu::graphite::MtlSharedContext::memoryAllocator ( ) const
inline

Definition at line 32 of file MtlSharedContext.h.

32{ return fMemoryAllocator.get(); }
T * get() const
Definition: SkRefCnt.h:303

◆ mtlCaps()

const MtlCaps & skgpu::graphite::MtlSharedContext::mtlCaps ( ) const
inline

Definition at line 36 of file MtlSharedContext.h.

36{ return static_cast<const MtlCaps&>(*this->caps()); }

The documentation for this class was generated from the following files: