<!--
{
  "availability" : [
    "iOS: 8.0.0 - 16.0.0",
    "iPadOS: 8.0.0 - 16.0.0",
    "macCatalyst: 13.1.0 - 16.0.0",
    "macOS: 10.11.0 - 13.0.0",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderPipelineDescriptor/sampleCount",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLRenderPipelineDescriptor(py)sampleCount"
  },
  "title" : "sampleCount"
}
-->

# sampleCount

The number of samples the pipeline applies for each fragment.

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

## Discussion

The render pipeline state honors this property only if the pipeline render targets support multisampling.

> Important:
> This property needs to be `1` if the render targets don’t support multisampling.

When your create an [`MTLRenderCommandEncoder`](/documentation/Metal/MTLRenderCommandEncoder) instance, this property’s value needs to be equal to the number of render target textures. Furthermore, the texture type of all render target textures need to be [`MTLTextureType.type2DMultisample`](/documentation/Metal/MTLTextureType/type2DMultisample).

The number of samples a GPU supports varies by device. You can check whether an [`MTLDevice`](/documentation/Metal/MTLDevice) instance supports a specific sample count by calling its [`supportsTextureSampleCount(_:)`](/documentation/Metal/MTLDevice/supportsTextureSampleCount(_:)) method.

The default value for this property is `1`.

---

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)