SPIRV-Cross/reference/opt/shaders-msl
Chip Davis fd738e3387 MSL: Adjust FragCoord for sample-rate shading.
In Metal, the `[[position]]` input to a fragment shader remains at
fragment center, even at sample rate, like OpenGL and Direct3D. In
Vulkan, however, when the fragment shader runs at sample rate, the
`FragCoord` builtin moves to the sample position in the framebuffer,
instead of the fragment center. To account for this difference, adjust
the `FragCoord`, if present, by the sample position. The -0.5 offset is
because the fragment center is at (0.5, 0.5).

Also, add an option to force sample-rate shading in a fragment shader.
Since Metal has no explicit control for this, this is done by adding a
dummy `[[sample_id]]` which is otherwise unused, if none is already
present. This is intended to be used from e.g. MoltenVK when a
pipeline's `minSampleShading` value is nonzero.

Instead of checking if any `Input` variables have `Sample`
interpolation, I've elected to check that the `SampleRateShading`
capability is present. Since `SampleId`, `SamplePosition`, and the
`Sample` interpolation decoration require this cap, this should be
equivalent for any valid SPIR-V module. If this isn't acceptable, let me
know.
2020-11-23 10:30:24 -06:00
..
amd Updates for pull request #1162 2019-09-24 14:35:25 -04:00
asm MSL: Support pull-model interpolation on MSL 2.3+. 2020-11-05 11:57:45 -06:00
comp MSL: Fix calculation of atomic image buffer address. 2020-10-13 20:51:56 -05:00
desktop-only MSL: Add support for processing more than one patch per workgroup. 2020-07-23 17:59:54 -05:00
flatten MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
intel Updates for pull request #1162 2019-09-24 14:35:25 -04:00
legacy/vert Updates for pull request #1162 2019-09-24 14:35:25 -04:00
tesc MSL: Don't use a bitcast for tessellation levels in tesc shaders. 2020-10-14 18:35:59 -05:00
tese Roll GLSLang, SPIRV-Headers and SPIRV-Tools. 2020-07-22 23:03:11 -04:00
vert Overhaul how we deal with reserved identifiers. 2020-08-21 16:33:27 +02:00
vulkan MSL: Support SPV_EXT_demote_to_helper_invocation for MSL 2.3. 2020-10-13 00:25:32 -05:00