SPIRV-Cross/shaders-msl/frag
Chip Davis 2eff420d9a Support the SPV_EXT_fragment_shader_interlock extension.
This was straightforward to implement in GLSL. The
`ShadingRateInterlockOrderedEXT` and `ShadingRateInterlockUnorderedEXT`
modes aren't implemented yet, because we don't support
`SPV_NV_shading_rate` or `SPV_EXT_fragment_invocation_density` yet.

HLSL and MSL were more interesting. They don't support this directly,
but they do support marking resources as "rasterizer ordered," which
does roughly the same thing. So this implementation scans all accesses
inside the critical section and marks all storage resources found
therein as rasterizer ordered. They also don't support the fine-grained
controls on pixel- vs. sample-level interlock and disabling ordering
guarantees that GLSL and SPIR-V do, but that's OK. "Unordered" here
merely means the order is undefined; that it just so happens to be the
same as rasterizer order is immaterial. As for pixel- vs. sample-level
interlock, Vulkan explicitly states:

> With sample shading enabled, [the `PixelInterlockOrderedEXT` and
> `PixelInterlockUnorderedEXT`] execution modes are treated like
> `SampleInterlockOrderedEXT` or `SampleInterlockUnorderedEXT`
> respectively.

and:

> If [the `SampleInterlockOrderedEXT` or `SampleInterlockUnorderedEXT`]
> execution modes are used in single-sample mode they are treated like
> `PixelInterlockOrderedEXT` or `PixelInterlockUnorderedEXT`
> respectively.

So this will DTRT for MoltenVK and gfx-rs, at least.

MSL additionally supports multiple raster order groups; resources that
are not accessed together can be placed in different ROGs to allow them
to be synchronized separately. A more sophisticated analysis might be
able to place resources optimally, but that's outside the scope of this
change. For now, we assign all resources to group 0, which should do for
our purposes.

`glslang` doesn't support the `RasterizerOrdered` UAVs this
implementation produces for HLSL, so the test case needs `fxc.exe`.

It also insists on GLSL 4.50 for `GL_ARB_fragment_shader_interlock`,
even though the spec says it needs either 4.20 or
`GL_ARB_shader_image_load_store`; and it doesn't support the
`GL_NV_fragment_shader_interlock` extension at all. So I haven't been
able to test those code paths.

Fixes #1002.
2019-09-02 12:31:10 -05:00
..
16bit-constants.invalid.frag Update external repos. 2019-07-13 16:50:21 -05:00
argument-buffers.msl2.argument.frag MSL: Need to emit two layers of address space. 2019-03-15 11:29:17 +01:00
array-lut-no-loop-variable.frag Disallow arrays and structs from becoming loop variables. 2018-03-07 14:54:11 +01:00
array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag MSL: Support argument buffers and image swizzling. 2019-05-18 10:30:06 +02:00
array-of-texture-swizzle.msl2.swizzle.frag MSL: Add test for passing single swizzled texture arg from array. 2019-05-09 14:19:40 +02:00
barycentric-nv-nopersp.msl22.frag MSL: Support PrimitiveID in fragment and barycentrics. 2019-06-19 09:52:35 +02:00
barycentric-nv.msl22.frag MSL: Support PrimitiveID in fragment and barycentrics. 2019-06-19 09:52:35 +02:00
basic.frag Add explicit in/out locations everywhere. 2017-06-21 09:39:08 +02:00
binary-func-unpack-pack-arguments.frag Unpack expressions when used in functions on MSL. 2018-06-11 10:56:45 +02:00
binary-unpack-pack-arguments.frag Also unpack regular unary/binary operations on MSL. 2018-06-11 16:23:09 +02:00
bitcasting.frag CompilerMSL map many GLSL functions to MSL functions. 2017-05-19 18:14:08 -04:00
buffer-read-write.frag MSL: Support native texture_buffer type, throw error on atomics. 2019-04-23 12:21:43 +02:00
buffer-read-write.texture-buffer-native.msl21.frag MSL: Support native texture_buffer type, throw error on atomics. 2019-04-23 12:21:43 +02:00
builtins.frag CompilerMSL enhancements. 2017-06-30 19:10:46 -04:00
complex-expression-in-access-chain.frag Register implied expression reads in OpLoad/OpAccessChain. 2019-01-04 14:56:12 +01:00
composite-extract-forced-temporary.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
constant-array.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
constant-composites.frag Do not declare constant composites inline in HLSL. 2018-02-02 10:12:26 +01:00
control-dependent-in-branch.desktop.frag Handle control-dependent temporaries. 2018-03-12 17:34:54 +01:00
depth-greater-than.frag MSL: Split out early_fragment_tests. 2018-11-12 16:20:49 +01:00
depth-less-than.frag MSL: Split out early_fragment_tests. 2018-11-12 16:20:49 +01:00
dual-source-blending.frag Support dual-source blending on GLSL and MSL. 2018-04-03 16:04:49 +02:00
early-fragment-tests.frag MSL: Split out early_fragment_tests. 2018-11-12 16:20:49 +01:00
false-loop-init.frag Add test for false loop init. 2018-01-23 21:15:09 +01:00
flush_params.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
for-loop-continue-control-flow.frag Fall back to complex loop if non-trivial continue block is found. 2019-07-08 11:54:29 +02:00
for-loop-init.frag Fix execution order for for-loop emission. 2017-02-04 10:07:20 +01:00
fp16-packing.frag Implement packHalf2x16/unpackHalf2x16 on MSL. 2018-03-12 17:51:14 +01:00
fp16.desktop.invalid.frag Update glslang and SPIRV-Tools. 2018-09-27 11:10:22 +02:00
fragment-component-padding.pad-fragment.frag MSL: Add option to pad fragment outputs. 2019-01-14 15:11:52 +01:00
front-facing.frag Add IsFrontFace support to HLSL. 2018-02-15 12:42:56 +01:00
gather-dref.frag Fix GatherDref on GLSL. 2018-04-30 12:45:23 +02:00
gather-offset.frag Compiler MSL default gather offset when component specified. 2018-04-30 16:30:29 -04:00
helper-invocation.msl21.frag Support gl_HelperInvocation on GLSL and MSL. 2018-11-28 15:18:43 +01:00
illegal-name-test-0.frag Add more illegal name replacement in MSL. 2018-04-03 15:36:35 +02:00
image-query-lod.msl22.frag MSL: Support OpImageQueryLod. 2019-06-19 09:51:56 +02:00
in_block.frag Assign block locations to members in MSL. 2017-06-21 09:55:46 +02:00
in_mat.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
input-attachment-ms.frag Support passing implicit frag_coord arguments down to functions. 2018-02-10 10:55:09 +01:00
input-attachment.frag Support passing implicit frag_coord arguments down to functions. 2018-02-10 10:55:09 +01:00
interpolation-qualifiers-block.frag Handle interpolation qualifiers on the entire struct, too. 2018-09-06 12:29:42 -05:00
interpolation-qualifiers.frag MSL: Handle interpolation qualifiers. 2018-09-05 12:02:07 -05:00
lut-promotion.frag Add some tests for LUT promotion. 2018-07-05 14:14:18 +02:00
mix.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
mrt-array.frag Properly flatten MRT outputs in MSL. 2018-03-13 14:03:35 +01:00
nonuniform-qualifier.msl2.frag Fix nonuniform test for MSL. 2019-05-13 15:14:18 +02:00
packed-expression-vector-shuffle.frag Deal with packed expressions in more scenarios. 2018-05-25 10:57:02 +02:00
packing-test-3.frag Add some more MSL test shaders. 2018-03-05 16:42:38 +01:00
pixel-interlock-ordered.msl2.argument.frag Support the SPV_EXT_fragment_shader_interlock extension. 2019-09-02 12:31:10 -05:00
pixel-interlock-ordered.msl2.frag Support the SPV_EXT_fragment_shader_interlock extension. 2019-09-02 12:31:10 -05:00
pls.frag Add explicit in/out locations everywhere. 2017-06-21 09:39:08 +02:00
post-depth-coverage.ios.msl2.frag Support the SPV_KHR_post_depth_coverage extension. 2019-07-11 10:28:43 -05:00
private-variable-prototype-declaration.frag MSL: Fix regression with Private parameter declaration. 2019-06-13 10:36:21 +02:00
readonly-ssbo.frag Add test for reading SSBO from fragment shader on MSL. 2018-05-25 10:20:17 +02:00
sample-depth-separate-image-sampler.frag Fix depth image usage in MSL for separate image/samplers. 2018-02-10 10:55:10 +01:00
sample-mask.frag CompilerMSL support gl_SampleMask and convert it to scalar uint from array. 2018-02-13 14:44:40 -05:00
sample-position-func.frag MSL: Handle the SamplePosition builtin. 2018-09-13 09:34:28 -05:00
sample-position.frag MSL: Handle the SamplePosition builtin. 2018-09-13 09:34:28 -05:00
sampler-1d-lod.frag Ignore LOD when sampling 1D textures in MSL. 2018-04-04 09:26:53 +02:00
sampler-compare-cascade-gradient.frag MSL: Workaround missing gradient2d() for sampler_compare. 2019-01-07 10:01:00 +01:00
sampler-compare-cascade-gradient.ios.frag MSL: Workaround missing gradient2d() for sampler_compare. 2019-01-07 10:01:00 +01:00
sampler-image-arrays.msl2.frag Add test for sampler image arrays. 2018-04-04 09:41:20 +02:00
sampler-ms.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
sampler.frag Add explicit in/out locations everywhere. 2017-06-21 09:39:08 +02:00
scalar-refract-reflect.frag MSL/HLSL: Support scalar reflect and refract. 2019-07-03 12:31:52 +02:00
separate-image-sampler-argument.frag Fix separate sampler images in MSL. 2017-05-07 12:36:14 +02:00
shader-arithmetic-8bit.frag MSL: Fix another test incompatibility. 2019-01-30 17:22:38 +01:00
shadow-compare-global-alias.invalid.frag Update glslang and SPIRV-Tools. 2018-09-27 11:10:22 +02:00
spec-constant-block-size.frag Support spec constant array size in blocks. 2018-02-23 15:11:45 +01:00
spec-constant-ternary.frag Support ternary expressions in OpSpecConstantOp. 2018-06-25 09:49:13 +02:00
stencil-export.msl21.frag MSL: Support stencil export. 2019-06-12 10:21:20 +02:00
subgroup-builtins.msl22.frag MSL: Add support for SubgroupSize / SubgroupInvocationID in fragment. 2019-06-24 12:31:54 +02:00
switch-unsigned-case.frag Fix unsigned switch case selectors. 2018-11-26 10:36:50 +01:00
swizzle.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01:00
texel-fetch-offset.frag MSL: Fix support for texelFetchOffset. 2018-08-07 15:28:04 +02:00
texture-multisample-array.msl21.frag MSL: Support texture2d_ms_array. 2018-09-03 11:02:31 +02:00
texture-proj-shadow.frag Fix issue #239: compilation of shaders-msl/frag/texture-proj-shadow.frag. 2017-08-11 14:54:58 -04:00
ubo_layout.frag Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
unary-enclose.frag Fix unary enclosures. 2017-07-24 10:17:19 +02:00
write-depth-in-function.frag MSL: Add test case for gl_FragDepth when used in function. 2018-08-29 09:21:48 +02:00