Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 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 60 of file MtlSharedContext.mm.

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

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 // TODO: This was taken from GrMtlGpu.mm's Make, does graphite deserve a higher version?
25 if (@available(macOS 10.14, iOS 11.0, tvOS 11.0, *)) {
26 // no warning needed
27 } else {
28 SKGPU_LOG_E("Skia's Graphite backend no longer supports this OS version.");
29#ifdef SK_BUILD_FOR_IOS
30 SKGPU_LOG_E("Minimum supported version is iOS 11.0.");
31#else
32 SKGPU_LOG_E("Minimum supported version is MacOS 10.14.");
33#endif
34 return nullptr;
35 }
36
37 sk_cfp<id<MTLDevice>> device = sk_ret_cfp((id<MTLDevice>)(context.fDevice.get()));
38
39 std::unique_ptr<const MtlCaps> caps(new MtlCaps(device.get(), options));
40
41 // TODO: Add memory allocator to context once we figure out synchronization
43 if (!memoryAllocator) {
44 SkDEBUGFAIL("No supplied Metal memory allocator and unable to create one internally.");
45 return nullptr;
46 }
47
48 return sk_sp<skgpu::graphite::SharedContext>(new MtlSharedContext(std::move(device),
49 std::move(memoryAllocator),
50 std::move(caps)));
51}
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
const Caps * caps() const

◆ 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 65 of file MtlSharedContext.mm.

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

◆ 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: