---
title: sampleCount
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtltexturedescriptor/samplecount
---

# sampleCount

The number of samples in each fragment.

## Declaration

```swift
var sampleCount: Int { get set }
```

## Discussion

Discussion The default value is 1. If textureType is not MTLTextureType.type2DMultisample or MTLTextureType.type2DMultisampleArray, this value needs to be 1. Support for different sample count values varies by device. Call the supportsTextureSampleCount(_:) method to determine if your desired sample count value is supported.

## See Also

### Specifying texture attributes

- [textureType](metal/mtltexturedescriptor/texturetype.md)
- [pixelFormat](metal/mtltexturedescriptor/pixelformat.md)
- [width](metal/mtltexturedescriptor/width.md)
- [height](metal/mtltexturedescriptor/height.md)
- [depth](metal/mtltexturedescriptor/depth.md)
- [mipmapLevelCount](metal/mtltexturedescriptor/mipmaplevelcount.md)
- [arrayLength](metal/mtltexturedescriptor/arraylength.md)
- [resourceOptions](metal/mtltexturedescriptor/resourceoptions.md)
- [cpuCacheMode](metal/mtltexturedescriptor/cpucachemode.md)
- [storageMode](metal/mtltexturedescriptor/storagemode.md)
- [hazardTrackingMode](metal/mtltexturedescriptor/hazardtrackingmode.md)
- [allowGPUOptimizedContents](metal/mtltexturedescriptor/allowgpuoptimizedcontents.md)
- [usage](metal/mtltexturedescriptor/usage.md)
- [swizzle](metal/mtltexturedescriptor/swizzle.md)
- [MTLTextureSwizzleChannels](metal/mtltextureswizzlechannels.md)
