getDefaultSamplePositions:count:
Retrieves the default sample positions for a specific sample count.
Declaration
- (void) getDefaultSamplePositions:(MTLSamplePosition *) positions count:(NSUInteger) count;Parameters
- positions:
A pointer to a destination C array of Mtlsampleposition instances — with at least
countelements — the method writes the default positions to. - count:
The number of points a GPU can sample from a texture. Ensure the GPU can support the
countvalue by first calling the device’s Supportstexturesamplecount(_:) method.
Mentioned in
Discussion
The default sample positions are the same on all GPUs that support programmable sample positions (see areProgrammableSamplePositionsSupported).
The default sample position for GPUs that can sample one time is at the pixel’s center.
[Image]
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.
[Image]
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.
[Image]
The default sample positions for GPUs that can sample eight times have two locations in each of the pixel’s quadrants.
[Image]
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 [Image] 1 | (0.75, 0.75) [Image] (0.25, 0.25) |
4 | 0 [Image] 1 [Image] 2 [Image] 3 | (0.375, 0.125) [Image] (0.875, 0.375) [Image] (0.125, 0.625) [Image] (0.625, 0.875) |
8 | 0 [Image] 1 [Image] 2 [Image] 3 [Image] 4 [Image] 5 [Image] 6 [Image] 7 | (0.5625, 0.3125) [Image] (0.4375, 0.6875) [Image] (0.8125, 0.5625) [Image] (0.3125, 0.1875) [Image] (0.1875, 0.8125) [Image] (0.0625, 0.4375) [Image] (0.6875, 0.9375) [Image] (0.9375, 0.0625) |