Instance Method

getDefaultSamplePositions(sampleCount:)

Retrieves the default sample positions for a specific sample count.

Declaration

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

Parameters

sampleCount

The set of default sample positions you want to retrieve. The value of sampleCount must be in the range supported by the device object.

Return Value

An array of sample positions for the specified sample count.

Discussion

The default sample positions are the same on all GPUs that support programmable sample positions. If areProgrammableSamplePositionsSupported for a device object is false, that device object may have sample positions that differ from these defaults. In that case, you can't retrieve information about the specific positions that GPU uses.

Before calling this method, call the supportsTextureSampleCount(_:) method to determine whether a device object supports a given sample count.

Default One-Sample Position

The following table and grid show the position index, values, and placement for the default one-sample position.

Position index

Position values

0

0.5, 0.5

Coordinate system diagram showing the subpixel grid on which the default one-sample position is set.

Default Two-Sample Positions

The following table and grid show the position indices, values, and placements for the default two-sample positions.

Position index

Position values

0

0.75, 0.75

1

0.25, 0.25

Coordinate system diagram showing the subpixel grid on which the default two-sample positions are set.

Default Four-Sample Positions

The following table and grid show the position indices, values, and placements for the default four-sample positions.

Position index

Position values

0

0.375, 0.125

1

0.875, 0.375

2

0.125, 0.625

3

0.625, 0.875

Coordinate system diagram showing the subpixel grid on which the default four-sample positions are set.

Default Eight-Sample Positions

The following table and grid show the position indices, values, and placements for the default eight-sample positions.

Position index

Position values

0

0.5625, 0.3125

1

0.4375, 0.6875

2

0.8125, 0.5625

3

0.3125, 0.1875

4

0.1875, 0.8125

5

0.0625, 0.4375

6

0.6875, 0.9375

7

0.9375, 0.0625

Coordinate system diagram showing the subpixel grid on which the default eight-sample positions are set.

See Also

Querying Programmable Sample Positions

var areProgrammableSamplePositionsSupported: Bool

A Boolean that indicates whether a device supports programmable sample positions.

Required.