---
title: "makeSamplerState(descriptor:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/makesamplerstate(descriptor:)"
---

# makeSamplerState(descriptor:)

Creates a sampler state instance.

## Declaration

```swift
func makeSamplerState(descriptor: MTLSamplerDescriptor) -> (any MTLSamplerState)?
```

## Parameters

- `descriptor`: An doc://com.apple.metal/documentation/Metal/MTLSamplerDescriptor instance.

## Return Value

Return Value A new MTLSamplerState instance if the method completed successfully; otherwise nil.

## See Also

### Creating samplers

- [supportsTextureSampleCount(_:)](metal/mtldevice/supportstexturesamplecount(_:).md)
- [getDefaultSamplePositions(sampleCount:)](metal/mtldevice/getdefaultsamplepositions(samplecount:).md)
