Use depth render targets and programmable sample positions effectively.
Depth data for render targets is usually stored in a compressed format that requires evaluation at specific sample positions for proper decompression. Depth render targets can now specify a
custom option that stores depth data in a sample-position-agnostic representation.
custom option indicates that the depth data will be read in a subsequent render pass, or blit operation, that's unaware of the programmable sample positions used to generate the data. For example, reading per-sample depth data within a fragment function that uses different programmable sample positions; or, issuing a copy operation from the MSAA depth data to another resource.
If you specify a
custom option, Metal may decompress the depth render target and store the resulting data in its decompressed form. If you don't change programmable sample positions in a subsequent render pass, specify a
MTLStore action instead with the
MTLStore option to improve performance.