---
title: "generateMipmaps(for:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlblitcommandencoder/generatemipmaps(for:)"
---

# generateMipmaps(for:)

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

## Declaration

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

## Parameters

- `texture`: A texture instance the command generates mipmaps for that has: A doc://com.apple.metal/documentation/Metal/MTLTexture/mipmapLevelCount property that’s greater than 1 A doc://com.apple.metal/documentation/Metal/MTLTexture/pixelFormat that’s color-renderable and color-filterable

## Mentioned in

Generating mipmap data

## Discussion

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 (MTLGPUFamily) it supports.
