SPIRV-Cross/reference/opt/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 Update glslang and SPIRV-Tools. 2018-09-27 11:10:22 +02:00
barycentric-nv.frag GLSL: Support NV barycentrics. 2019-06-19 09:52:35 +02:00
basic.frag Add reference output for --opt. 2017-11-23 09:50:11 +01: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 Add reference output for --opt. 2017-11-23 09:50:11 +01:00
constant-array.frag Rewrite how IDs are iterated over. 2019-01-10 12:52:56 +01:00
constant-composites.frag Rewrite how IDs are iterated over. 2019-01-10 12:52:56 +01:00
false-loop-init.frag Update glslang and SPIRV-Tools. 2018-09-27 11:10:22 +02:00
flush_params.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01: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 Do not eagerly invalidate all active variables on a branch. 2019-07-24 11:17:30 +02:00
frexp-modf.frag Add reference output for --opt. 2017-11-23 09:50:11 +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
ground.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +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 Move branchless analysis to CFG. 2019-08-27 10:19:19 +02: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 case where a variable is dominated by inner part of a loop. 2019-06-06 11:11:44 +02:00
loop-dominator-and-switch-default.frag Move branchless analysis to CFG. 2019-08-27 10:19:19 +02:00
lut-promotion.frag Update glslang and SPIRV-Tools. 2018-09-27 11:10:22 +02:00
mix.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01:00
partial-write-preserve.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01: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 reference output for --opt. 2017-11-23 09:50:11 +01: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 reference output for --opt. 2017-11-23 09:50:11 +01:00
sampler-ms.frag Add reference output for --opt. 2017-11-23 09:50:11 +01:00
sampler-proj.frag Add reference output for --opt. 2017-11-23 09:50:11 +01:00
sampler.frag Add reference output for --opt. 2017-11-23 09:50:11 +01: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 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
ubo_layout.frag Update tests. 2018-03-05 16:34:42 +01:00
unary-enclose.frag Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01:00