<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVMetalTextureCacheCreate(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "c:@F@CVMetalTextureCacheCreate"
  },
  "title" : "CVMetalTextureCacheCreate(_:_:_:_:_:)"
}
-->

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

Creates a new texture cache.

```
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 [Cache Attributes](/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

Upon successful creation of the texture cache, this function returns [`kCVReturnSuccess`](/documentation/CoreVideo/kCVReturnSuccess).

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)