SPIRV-Cross/reference/shaders-msl/frag
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
..
argument-buffers.msl2.argument.frag MSL: Do not declare array of UBO/SSBO as spvUnsafeArray<T>. 2019-10-26 16:10:08 +02:00
array-lut-no-loop-variable.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
array-of-array-lut.frag MSL: Fix array of array declaration. 2019-10-26 16:10:12 +02:00
array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag MSL: Don't remove periods from swizzle buffer index exprs. 2020-10-20 17:47:40 -05:00
array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag MSL: Don't remove periods from swizzle buffer index exprs. 2020-10-20 17:47:40 -05:00
array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag Update for pull request #1162 rev. 1 2019-09-24 18:13:04 -04:00
array-of-texture-swizzle.msl2.swizzle.frag Update for pull request #1162 rev. 1 2019-09-24 18:13:04 -04:00
barycentric-nv-nopersp.msl22.frag MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
barycentric-nv.msl22.frag MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
basic.force-sample.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
basic.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
binary-func-unpack-pack-arguments.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
binary-unpack-pack-arguments.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
bitcasting.1d-as-2d.frag MSL: Handle Offset and Grad operands for 1D-as-2D textures. 2020-10-15 12:51:00 -05:00
bitcasting.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
buffer-read-write.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
buffer-read-write.texture-buffer-native.msl21.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
builtins.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
clip-distance-varying.frag MSL: Support ClipDistance as an input stage variable. 2019-12-02 13:19:42 +01:00
complex-expression-in-access-chain.frag MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
composite-extract-forced-temporary.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
constant-array.frag Roll GLSLang, SPIRV-Headers and SPIRV-Tools. 2020-07-22 23:03:11 -04:00
constant-composites.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
control-dependent-in-branch.desktop.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
depth-greater-than.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
depth-less-than.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
disable-frag-output.frag-output.frag MSL: Add options to control emission of fragment outputs. 2020-04-13 15:29:11 -05:00
dual-source-blending.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
early-fragment-tests.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
false-loop-init.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
flush_params.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
for-loop-continue-control-flow.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
for-loop-init.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
fp16-packing.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
fragment-component-padding.pad-fragment.frag MSL: Deal with packing vectors for vertex input/fragment output. 2020-01-07 14:14:31 +01:00
front-facing.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
gather-dref.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
gather-offset.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
helper-invocation.msl21.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
huge-argument-buffer.device-argument-buffer.argument.msl2.frag MSL: Do not declare array of UBO/SSBO as spvUnsafeArray<T>. 2019-10-26 16:10:08 +02:00
illegal-name-test-0.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
image-query-lod.msl22.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
in_block.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
in_mat.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
input-attachment-ms.arrayed-subpass.msl21.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
input-attachment-ms.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
input-attachment-ms.multiview.msl21.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
input-attachment.arrayed-subpass.frag MSL: Support layered input attachments. 2020-09-02 09:18:25 -05:00
input-attachment.frag MSL: Support layered input attachments. 2020-09-02 09:18:25 -05:00
input-attachment.multiview.frag MSL: Support layered input attachments. 2020-09-02 09:18:25 -05:00
interpolation-qualifiers-block.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
interpolation-qualifiers.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
lut-promotion.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
mix.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
mrt-array.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
nonuniform-qualifier.msl2.frag MSL: Do not declare array of UBO/SSBO as spvUnsafeArray<T>. 2019-10-26 16:10:08 +02:00
packed-expression-vector-shuffle.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
packing-test-3.frag Overhaul how we deal with reserved identifiers. 2020-08-21 16:33:27 +02:00
pixel-interlock-ordered.msl2.argument.frag MSL: Fix calculation of atomic image buffer address. 2020-10-13 20:51:56 -05:00
pixel-interlock-ordered.msl2.frag MSL: Fix calculation of atomic image buffer address. 2020-10-13 20:51:56 -05:00
pls.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
post-depth-coverage.ios.msl2.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
post-depth-coverage.msl23.frag MSL: Allow post-depth coverage on Mac in MSL 2.3. 2020-10-27 22:07:01 -05:00
private-variable-prototype-declaration.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
readonly-ssbo.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sample-depth-propagate-state-from-resource.frag MSL: Rewrite propagated depth comparison state handling. 2019-10-26 16:10:11 +02:00
sample-depth-separate-image-sampler.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sample-mask-in-and-out.fixed-sample-mask.frag Enabling setting a fixed sampleMask in Metal fragment shaders. 2020-07-24 11:19:46 +02:00
sample-mask-not-used.fixed-sample-mask.frag Enabling setting a fixed sampleMask in Metal fragment shaders. 2020-07-24 11:19:46 +02:00
sample-mask.fixed-sample-mask.frag Enabling setting a fixed sampleMask in Metal fragment shaders. 2020-07-24 11:19:46 +02:00
sample-mask.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sample-position-func.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sample-position.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sample-rate-frag-coord-sample-id.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
sample-rate-frag-coord-sample-input.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
sample-rate-frag-coord-sample-pos.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
sample-rate-frag-coord.force-sample.frag MSL: Adjust FragCoord for sample-rate shading. 2020-11-23 10:30:24 -06:00
sampler-1d-lod.1d-as-2d.frag MSL: Handle Offset and Grad operands for 1D-as-2D textures. 2020-10-15 12:51:00 -05:00
sampler-1d-lod.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sampler-compare-bias.msl23.1d-as-2d.frag MSL: Allow Bias and Grad arguments with comparison on Mac in MSL 2.3. 2020-10-30 11:14:59 -05:00
sampler-compare-cascade-gradient.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sampler-compare-cascade-gradient.ios.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sampler-compare-cascade-gradient.msl23.frag MSL: Allow Bias and Grad arguments with comparison on Mac in MSL 2.3. 2020-10-30 11:14:59 -05:00
sampler-image-arrays.msl2.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sampler-ms.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
sampler.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
scalar-refract-reflect.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
separate-image-sampler-argument.frag Roll GLSLang, SPIRV-Headers and SPIRV-Tools. 2020-07-22 23:03:11 -04:00
shader-arithmetic-8bit.frag MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
spec-constant-block-size.frag MSL: Do not generate UnsafeArray<> for any array inside buffer objects. 2019-10-24 12:22:30 +02:00
spec-constant-ternary.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
stencil-export.msl21.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
subgroup-builtins.msl22.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
subgroup-globals-extract.msl22.frag MSL: extract global variables from subgroup ballot operations 2020-11-09 11:23:01 +01:00
switch-unsigned-case.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
swizzle.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
texel-fetch-offset.1d-as-2d.frag MSL: Handle Offset and Grad operands for 1D-as-2D textures. 2020-10-15 12:51:00 -05:00
texel-fetch-offset.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
texture-cube-array.frag Further updates for pull request #1162; also added two test cases for spvCubemapTo2DArrayFace function and added '--msl-framebuffer-fetch'/ '--msl-emulate-cube-array' compiler options. 2019-09-27 15:49:54 -04:00
texture-cube-array.ios.emulate-cube-array.frag Further updates for pull request #1162; also added two test cases for spvCubemapTo2DArrayFace function and added '--msl-framebuffer-fetch'/ '--msl-emulate-cube-array' compiler options. 2019-09-27 15:49:54 -04:00
texture-multisample-array.msl21.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
texture-proj-shadow.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
ubo_layout.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
unary-enclose.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00
vecsize-mismatch.shader-inputs.frag MSL: Fix up input variables' vector lengths in all stages. 2020-06-16 14:50:30 -05:00
write-depth-in-function.frag Updates for pull request #1162 2019-09-24 14:35:25 -04:00