---
title: Tracking the resource residency of argument buffers
framework: metal
role: article
role_heading: Article
path: metal/tracking-the-resource-residency-of-argument-buffers
---

# Tracking the resource residency of argument buffers

Optimize resource performance within an argument buffer.

## Overview

Overview The Metal driver can’t automatically track the residency of argument buffer resources, but you can track it manually. Track argument buffer resource residency manually Call an MTLRenderCommandEncoder or MTLComputeCommandEncoder method: For individual resources, call useResource(_:usage:stages:) or useResource(_:usage:). For all resources in a heap, call useHeap(_:stages:) or useHeap(_:). These methods perform two important functions: They add argument buffer resources to the set of resources that the render or compute pass needs resident. They ensure that argument buffer resources are in a format that’s compatible with the required function operation, as an MTLResourceUsage value specifies. The methods with a stages parameter also insert dependency hazards, similar to MTLFence instances for that stage. Call these methods before issuing any draw or dispatch calls that may access the specified resources. note: To track resource access and dependency hazards, use MTLFence instances. If all the required resources aren’t resident when executing a render or compute pass, the associated MTLCommandBuffer instance fails.

## See Also

### Argument buffers

- [Improving CPU performance by using argument buffers](metal/improving-cpu-performance-by-using-argument-buffers.md)
- [Managing groups of resources with argument buffers](metal/managing-groups-of-resources-with-argument-buffers.md)
- [Indexing argument buffers](metal/indexing-argument-buffers.md)
- [Rendering terrain dynamically with argument buffers](metal/rendering-terrain-dynamically-with-argument-buffers.md)
- [Encoding argument buffers on the GPU](metal/encoding-argument-buffers-on-the-gpu.md)
- [Using argument buffers with resource heaps](metal/using-argument-buffers-with-resource-heaps.md)
- [MTLArgumentDescriptor](metal/mtlargumentdescriptor.md)
- [MTLArgumentEncoder](metal/mtlargumentencoder.md)
- [MTLAttributeStrideStatic](metal/mtlattributestridestatic.md)
