<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/getDefaultSamplePositions(sampleCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So9MTLDeviceP5MetalE25getDefaultSamplePositions11sampleCountSaySo17MTLSamplePositionaGSi_tF"
  },
  "title" : "getDefaultSamplePositions(sampleCount:)"
}
-->

# getDefaultSamplePositions(sampleCount:)

Returns the default sample locations based on the number of samples.

```
func getDefaultSamplePositions(sampleCount: Int) -> [MTLSamplePosition]
```

## Parameters

`sampleCount`

The number of points a GPU can sample from a texture. Ensure the GPU can support the `sampleCount` value by first calling the device’s [`supportsTextureSampleCount(_:)`](/documentation/Metal/MTLDevice/supportsTextureSampleCount(_:)) method.

## Return Value

An array of [`MTLSamplePosition`](/documentation/Metal/MTLSamplePosition) instances.

## Discussion

The default sample positions are the same on all GPUs that support programmable sample positions (see [`areProgrammableSamplePositionsSupported`](/documentation/Metal/MTLDevice/areProgrammableSamplePositionsSupported)).

> Note:
> GPUs that don’t support programmable sample positions may have different default sample positions that you can’t retrieve.

The default sample position for GPUs that can sample one time is at the pixel’s center.

![Normalized coordinate system diagram that shows a subpixel grid with one point at the center, with coordinates zero-.5, zero-0.5.](images/com.apple.metal/positioning-samples-programmatically-2@2x.png)

The default sample positions for GPUs that can sample two times have locations in the center of the pixel’s second quadrant and fourth quadrants.

![Normalized coordinate system diagram that shows a subpixel grid with two points, one located at zero-.25, zero-0.25. and the other at zero-.75, zero-0.75.](images/com.apple.metal/getDefaultSamplePositions-2@2x.png)

The default sample positions for GPUs that can sample four times have one location in each of the pixel’s quadrants. Each location is at the center of one of that quadrant’s subquadrants.

![Normalized coordinate system diagram that shows a subpixel grid with four points. Each of the pixel’s four quadrants contains one point.](images/com.apple.metal/getDefaultSamplePositions-3@2x.png)

The default sample positions for GPUs that can sample eight times have two locations in each of the pixel’s quadrants.

![Normalized coordinate system diagram that shows a subpixel grid with four points. Each of the pixel’s four quadrants contains two points. ](images/com.apple.metal/getDefaultSamplePositions-4@2x.png)

The table lists the indices and default locations for GPUs that support 1, 2, 4, or 8 sample positions.

|Sample count|Position indices                                                                                   |Subpixel coordinates                                                                                                                                                                                                       |
|------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|1           |0                                                                                                  |(0.5, 0.5)                                                                                                                                                                                                                 |
|2           |0 ![](spacer) 1                                                                                    |(0.75, 0.75) ![](spacer) (0.25, 0.25)                                                                                                                                                                                      |
|4           |0 ![](spacer) 1 ![](spacer) 2 ![](spacer) 3                                                        |(0.375, 0.125) ![](spacer) (0.875, 0.375) ![](spacer) (0.125, 0.625) ![](spacer) (0.625, 0.875)                                                                                                                            |
|8           |0 ![](spacer) 1 ![](spacer) 2 ![](spacer) 3 ![](spacer) 4 ![](spacer) 5 ![](spacer) 6 ![](spacer) 7|(0.5625, 0.3125) ![](spacer) (0.4375, 0.6875) ![](spacer) (0.8125, 0.5625) ![](spacer) (0.3125, 0.1875) ![](spacer) (0.1875, 0.8125) ![](spacer) (0.0625, 0.4375) ![](spacer) (0.6875, 0.9375) ![](spacer) (0.9375, 0.0625)|

---

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)