Configure the position of samples when rendering to a multisampled render target.
Traditional multisample anti-aliasing (MSAA) operations use fixed sample positions, defined by the GPU, that sample and resolve subpixels using the same pattern for all render passes.
Programmable sample positions unlock additional rendering techniques because they can be configured into custom patterns that can be reused or repositioned for any render pass.
The Subpixel Grid
Programmable sample positions are set on a 4-bit subpixel grid (16 x 16 subpixels). Floating-point values are in the
[0 range along each axis, with the origin
(0, 0) defined at the top-left corner. Values can be set from
0/16 up to
15/16, inclusive, in
1/16 increments along each axis.
Specifying Programmable Sample Positions
The following grid shows the programmable sample positions in the
Querying Default Sample Positions
You can query sample positions for a specific sample count by calling the
Default 1-sample Position
The following table and grid show the position index, values, and placement for the default 1-sample position.
Default 2-sample Positions
The following table and grid show the position indices, values, and placements for the default 2-sample positions.
Default 4-sample Positions
The following table and grid show the position indices, values, and placements for the default 4-sample positions.
Default 8-sample Positions
The following table and grid show the position indices, values, and placements for the default 8-sample positions.
Support for Programmable Sample Positions
Support for programmable sample positions varies by device. You can query it by calling the
Additionally, the number of programmable sample positions supported (the number of elements in a
MTLSample array) depends on the supported sample count. This value also varies by device; you can query it by calling the