SPIRV-Cross/reference/shaders/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
array-lut-no-loop-variable.frag Deduce constant LUTs from read-write variables. 2018-07-05 13:25:57 +02:00
barycentric-nv.frag GLSL: Support NV 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
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 Defer parenthesis generation until needed. 2016-12-05 10:56:54 +01:00
constant-array.frag Rewrite how IDs are iterated over. 2019-01-10 12:52:56 +01:00
constant-composites.frag Support LUTs in single-function CFGs on Private storage class. 2019-02-06 10:38:59 +01:00
false-loop-init.frag Add test for false loop init. 2018-01-23 21:15:09 +01:00
flush_params.frag Preserve arguments with inout unless complete writes are made. 2017-08-09 17:06:41 +02: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 Sort loop variables to make sure Travis CI runs are reproducable. 2016-12-16 14:01:09 +01:00
frexp-modf.frag Support FrexpStruct/ModfStruct. 2017-09-04 10:27:08 +02: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
ground.frag Update glslang to latest on Travis. 2017-02-11 10:52:34 +01:00
helper-invocation.frag Support gl_HelperInvocation on GLSL and MSL. 2018-11-28 15:18:43 +01:00
hoisted-temporary-use-continue-block-as-value.frag Fix case where hoisted temporaries were used before being declared. 2018-02-15 10:52:56 +01:00
image-load-store-uint-coord.asm.frag Make sure image integer coords are int, not uint. 2017-12-01 15:02:50 +01:00
inside-loop-dominated-variable-preservation.frag Deal with nested loops. 2019-06-06 14:37:02 +02:00
loop-dominator-and-switch-default.frag Add test case for continue out of switch default block. 2018-09-18 11:01:15 +02:00
lut-promotion.frag Add some tests for LUT promotion. 2018-07-05 14:14:18 +02:00
mix.frag Avoid boolean mix in HLSL. 2017-05-04 10:28:30 +02:00
partial-write-preserve.frag Preserve arguments with inout unless complete writes are made. 2017-08-09 17:06:41 +02:00
pixel-interlock-ordered.frag Support the SPV_EXT_fragment_shader_interlock extension. 2019-09-02 12:31:10 -05:00
pixel-interlock-unordered.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-es.frag GLSL: Fix post-depth coverage for ESSL. 2019-08-28 13:40:13 -05:00
post-depth-coverage.frag GLSL: Fix post-depth coverage for ESSL. 2019-08-28 13:40:13 -05:00
sample-interlock-ordered.frag Support the SPV_EXT_fragment_shader_interlock extension. 2019-09-02 12:31:10 -05:00
sample-interlock-unordered.frag Support the SPV_EXT_fragment_shader_interlock extension. 2019-09-02 12:31:10 -05:00
sample-parameter.frag Add support for SampleId/SampleMask/SamplePosition builtins. 2017-07-24 10:07:31 +02:00
sampler-ms.frag Defer parenthesis generation until needed. 2016-12-05 10:56:54 +01:00
sampler-proj.frag Always make a copy when handling OpCompositeInsert 2017-06-26 18:32:53 +01: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
selection-block-dominator.frag Fix variable scope when an if or else block dominates a variable. 2019-07-03 11:18:50 +02:00
switch-unsigned-case.frag Fix unsigned switch case selectors. 2018-11-26 10:36:50 +01:00
swizzle.frag Rewrite everything to use Bitset rather than uint64_t. 2018-03-12 13:24:14 +01:00
texel-fetch-offset.frag MSL: Fix support for texelFetchOffset. 2018-08-07 15:28:04 +02:00
ubo_layout.frag Update tests. 2018-03-05 16:34:42 +01:00
unary-enclose.frag Fix unary enclosures. 2017-07-24 10:17:19 +02:00