---
title: "CVMetalTextureCacheCreate(_:_:_:_:_:)"
framework: corevideo
role: symbol
role_heading: Function
path: "corevideo/cvmetaltexturecachecreate(_:_:_:_:_:)"
---

# CVMetalTextureCacheCreate(_:_:_:_:_:)

Creates a new texture cache.

## Declaration

```swift
func CVMetalTextureCacheCreate(_ allocator: CFAllocator?, _ cacheAttributes: CFDictionary?, _ metalDevice: any MTLDevice, _ textureAttributes: CFDictionary?, _ cacheOut: UnsafeMutablePointer<CVMetalTextureCache?>) -> CVReturn
```

## Parameters

- `allocator`: The memory allocator for the texture.
- `cacheAttributes`: A dictionary specifying options for the cache’s behavior, or NULL to use default options. For applicable keys and values, see doc://com.apple.corevideo/documentation/CoreVideo/CVMetalTextureCache-cache-attributes.
- `metalDevice`: The Metal device used to create texture objects.
- `textureAttributes`: A dictionary specifying options for creating textures from the cache, or NULL to use default options.
- `cacheOut`: Upon return, contains the newly created texture cache. When this value is NULL, an error occurred in texture creation.

## Return Value

Return Value Upon successful creation of the texture cache, this function returns kCVReturnSuccess.

## See Also

### Functions

- [CVMetalTextureCacheCreateTextureFromImage(_:_:_:_:_:_:_:_:_:)](corevideo/cvmetaltexturecachecreatetexturefromimage(_:_:_:_:_:_:_:_:_:).md)
- [CVMetalTextureCacheFlush(_:_:)](corevideo/cvmetaltexturecacheflush(_:_:).md)
- [CVMetalTextureCacheGetTypeID()](corevideo/cvmetaltexturecachegettypeid().md)
