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

#include <MtlBuffer.h>

Inheritance diagram for skgpu::graphite::MtlBuffer:
skgpu::graphite::Buffer skgpu::graphite::Resource

Public Member Functions

id< MTLBuffer > mtlBuffer () const
 
- Public Member Functions inherited from skgpu::graphite::Buffer
size_t size () const
 
void * map ()
 
void asyncMap (GpuFinishedProc=nullptr, GpuFinishedContext=nullptr)
 
void unmap ()
 
bool isMapped () const
 
virtual bool isUnmappable () const
 
const char * getResourceType () const override
 
- Public Member Functions inherited from skgpu::graphite::Resource
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
Resourceoperator= (const Resource &)=delete
 
Resourceoperator= (Resource &&)=delete
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
Ownership ownership () const
 
skgpu::Budgeted budgeted () const
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
virtual const char * getResourceType () const =0
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
bool wasDestroyed () const
 
const GraphiteResourceKeykey () const
 
void setKey (const GraphiteResourceKey &key)
 
void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual void prepareForReturnToCache (const std::function< void()> &takeRef)
 

Static Public Member Functions

static sk_sp< BufferMake (const MtlSharedContext *, size_t size, BufferType type, AccessPattern)
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::Buffer
 Buffer (const SharedContext *sharedContext, size_t size, bool commandBufferRefsAsUsageRefs=false)
 
- Protected Member Functions inherited from skgpu::graphite::Resource
 Resource (const SharedContext *, Ownership, skgpu::Budgeted, size_t gpuMemorySize, bool commandBufferRefsAsUsageRefs=false)
 
virtual ~Resource ()
 
const SharedContextsharedContext () const
 
virtual void onDumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const
 
void setDeleteASAP ()
 
- Protected Attributes inherited from skgpu::graphite::Buffer
void * fMapPtr = nullptr
 

Detailed Description

Definition at line 20 of file MtlBuffer.h.

Member Function Documentation

◆ Make()

sk_sp< Buffer > skgpu::graphite::MtlBuffer::Make ( const MtlSharedContext sharedContext,
size_t  size,
BufferType  type,
AccessPattern  accessPattern 
)
static

Definition at line 15 of file MtlBuffer.mm.

18 {
19 if (size <= 0) {
20 return nullptr;
21 }
22
23 NSUInteger options = 0;
24 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
25 if (accessPattern == AccessPattern::kHostVisible) {
26#ifdef SK_BUILD_FOR_MAC
27 const MtlCaps& mtlCaps = sharedContext->mtlCaps();
28 if (mtlCaps.isMac()) {
29 options |= MTLResourceStorageModeManaged;
30 } else {
31 SkASSERT(mtlCaps.isApple());
32 options |= MTLResourceStorageModeShared;
33 }
34#else
35 options |= MTLResourceStorageModeShared;
36#endif
37 } else {
38 options |= MTLResourceStorageModePrivate;
39 }
40 }
41
42 sk_cfp<id<MTLBuffer>> buffer([sharedContext->device() newBufferWithLength:size
44
45 return sk_sp<Buffer>(new MtlBuffer(sharedContext, size, std::move(buffer)));
46}
const char * options
#define SkASSERT(cond)
Definition: SkAssert.h:116
size_t size() const
Definition: Buffer.h:19
const SharedContext * sharedContext() const
Definition: Resource.h:189
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ mtlBuffer()

id< MTLBuffer > skgpu::graphite::MtlBuffer::mtlBuffer ( ) const
inline

Definition at line 24 of file MtlBuffer.h.

24{ return fBuffer.get(); }

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