---
title: "optimizeContentsForGPUAccess(texture:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlblitcommandencoder/optimizecontentsforgpuaccess(texture:)"
---

# optimizeContentsForGPUAccess(texture:)

Encodes a command that improves the performance of GPU memory operations with a texture.

## Declaration

```swift
func optimizeContentsForGPUAccess(texture: any MTLTexture)
```

## Parameters

- `texture`: A texture the command optimizes.

## Mentioned in

Optimizing texture data

## Discussion

Discussion This command can reduce the time it takes the GPU to access a texture. Apps typically run the command for: Textures the GPU accesses for an extended period of time Textures with a storageMode property that’s MTLStorageMode.shared or MTLStorageMode.managed When a blit pass runs this command, the GPU only applies lossless changes to the texture’s underlying data. note: Optimizing a texture for the GPU may affect the performance of CPU memory operations, but the data the CPU retrieves from the texture remains consistent.

## See Also

### Optimizing textures for GPU access

- [optimizeContentsForGPUAccess(texture:slice:level:)](metal/mtlblitcommandencoder/optimizecontentsforgpuaccess(texture:slice:level:).md)
