---
title: "texture2DDescriptor(pixelFormat:width:height:mipmapped:)"
framework: metal
role: symbol
role_heading: Type Method
path: "metal/mtltexturedescriptor/texture2ddescriptor(pixelformat:width:height:mipmapped:)"
---

# texture2DDescriptor(pixelFormat:width:height:mipmapped:)

Creates a texture descriptor object for a 2D texture.

## Declaration

```swift
class func texture2DDescriptor(pixelFormat: MTLPixelFormat, width: Int, height: Int, mipmapped: Bool) -> MTLTextureDescriptor
```

## Parameters

- `pixelFormat`: The format describing how every pixel on the texture image is stored. The default value is doc://com.apple.metal/documentation/Metal/MTLPixelFormat/rgba8Unorm.
- `width`: The width of the 2D texture image. The value needs to be greater than or equal to 1.
- `height`: The height of the 2D texture image. The value needs to be greater than or equal to 1.
- `mipmapped`: A Boolean indicating whether the resulting image should be mipmapped. If doc://com.apple.documentation/documentation/Swift/true, then the doc://com.apple.metal/documentation/Metal/MTLTextureDescriptor/mipmapLevelCount property in the returned descriptor is computed from width and height. If doc://com.apple.documentation/documentation/Swift/false, then doc://com.apple.metal/documentation/Metal/MTLTextureDescriptor/mipmapLevelCount is 1.

## Return Value

Return Value A pointer to a texture descriptor object for a 2D texture.

## See Also

### Related Documentation

- [Metal Shading Language Guide](apple-archive/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction.md)
- [Metal Programming Guide](apple-archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction.md)

### Creating texture descriptors

- [textureCubeDescriptor(pixelFormat:size:mipmapped:)](metal/mtltexturedescriptor/texturecubedescriptor(pixelformat:size:mipmapped:).md)
- [textureBufferDescriptor(with:width:resourceOptions:usage:)](metal/mtltexturedescriptor/texturebufferdescriptor(with:width:resourceoptions:usage:).md)
