<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLBlitCommandEncoder/generateMipmaps(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLBlitCommandEncoder(im)generateMipmapsForTexture:"
  },
  "title" : "generateMipmaps(for:)"
}
-->

# generateMipmaps(for:)

Encodes a command that generates mipmaps for a texture from the base mipmap level up to the highest mipmap level.

```
func generateMipmaps(for texture: any MTLTexture)
```

## Parameters

`texture`

A texture instance the command generates mipmaps for that has:

- A [`mipmapLevelCount`](/documentation/Metal/MTLTexture/mipmapLevelCount) property that’s greater than `1`
- A [`pixelFormat`](/documentation/Metal/MTLTexture/pixelFormat) that’s color-renderable and color-filterable

## Discussion

The command generates with scaled images for all levels up to the highest mipmap level.

> Note:
> The image filtering that GPU drivers use to generate the mipmaps may vary by the feature families (``doc://com.apple.metal/documentation/Metal/MTLGPUFamily``) it supports.

---

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)