---
title: MTLResource
framework: metal
role: symbol
role_heading: Protocol
path: metal/mtlresource
---

# MTLResource

An allocation of memory accessible to a GPU.

## Declaration

```swift
protocol MTLResource : MTLAllocation
```

## Mentioned in

Choosing a resource storage mode for Intel and AMD GPUs Synchronizing a managed resource in macOS

## Overview

Overview important: Don’t implement this protocol yourself. Create resources by calling methods on MTLDevice, MTLBuffer, or MTLTexture. When you execute commands on the GPU, those commands can only affect memory allocated as MTLResource objects. Only the MTLDevice that created these resources can modify them. Different resource types have different uses. The most common resource types are buffers (MTLBuffer), which are linear allocations of memory, and textures (MTLTexture), which hold structured image data.

## Topics

### Identifying the resource

- [device](metal/mtlresource/device.md)
- [label](metal/mtlresource/label.md)

### Reading memory and storage properties

- [cpuCacheMode](metal/mtlresource/cpucachemode.md)
- [storageMode](metal/mtlresource/storagemode.md)
- [hazardTrackingMode](metal/mtlresource/hazardtrackingmode.md)
- [resourceOptions](metal/mtlresource/resourceoptions.md)
- [MTLCPUCacheMode](metal/mtlcpucachemode.md)
- [MTLStorageMode](metal/mtlstoragemode.md)
- [MTLHazardTrackingMode](metal/mtlhazardtrackingmode.md)

### Setting the purgeable state of the resource

- [setPurgeableState(_:)](metal/mtlresource/setpurgeablestate(_:).md)
- [MTLPurgeableState](metal/mtlpurgeablestate.md)

### Managing heap resources

- [heapOffset](metal/mtlresource/heapoffset.md)
- [heap](metal/mtlresource/heap.md)
- [makeAliasable()](metal/mtlresource/makealiasable().md)
- [isAliasable()](metal/mtlresource/isaliasable().md)

### Querying the allocated size

- [allocatedSize](metal/mtlresource/allocatedsize.md)

## Relationships

### Inherits From

- [MTLAllocation](metal/mtlallocation.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Inherited By

- [MTLAccelerationStructure](metal/mtlaccelerationstructure.md)
- [MTLBuffer](metal/mtlbuffer.md)
- [MTLIndirectCommandBuffer](metal/mtlindirectcommandbuffer.md)
- [MTLIntersectionFunctionTable](metal/mtlintersectionfunctiontable.md)
- [MTLTensor](metal/mtltensor.md)
- [MTLTexture](metal/mtltexture.md)
- [MTLVisibleFunctionTable](metal/mtlvisiblefunctiontable.md)

## See Also

### Common resource functionality

- [MTLGPUAddress](metal/mtlgpuaddress.md)
- [MTLAllocation](metal/mtlallocation.md)
- [MTLResourceOptions](metal/mtlresourceoptions.md)
- [MTLResourceUsage](metal/mtlresourceusage.md)
- [MTLResourceID](metal/mtlresourceid.md)
