SPIRV-Cross/reference/opt/shaders-msl/frag
Chip Davis 39dce88d3b MSL: Add support for sampler Y'CbCr conversion.
This change introduces functions and in one case, a class, to support
the `VK_KHR_sampler_ycbcr_conversion` extension. Except in the case of
GBGR8 and BGRG8 formats, for which Metal natively supports implicit
chroma reconstruction, we're on our own here. We have to do everything
ourselves. Much of the complexity comes from the need to support
multiple planes, which must now be passed to functions that use the
corresponding combined image-samplers. The rest is from the actual
Y'CbCr conversion itself, which requires additional post-processing of
the sample retrieved from the image.

Passing sampled images to a function was a particular problem. To
support this, I've added a new class which is emitted to MSL shaders
that pass sampled images with Y'CbCr conversions attached around. It
can handle sampled images with or without Y'CbCr conversion. This is an
awful abomination that should not exist, but I'm worried that there's
some shader out there which does this. This support requires Metal 2.0
to work properly, because it uses default-constructed texture objects,
which were only added in MSL 2. I'm not even going to get into arrays of
combined image-samplers--that's a whole other can of worms.  They are
deliberately unsupported in this change.

I've taken the liberty of refactoring the support for texture swizzling
while I'm at it. It's now treated as a post-processing step similar to
Y'CbCr conversion. I'd like to think this is cleaner than having
everything in `to_function_name()`/`to_function_args()`. It still looks
really hairy, though. I did, however, get rid of the explicit type
arguments to `spvGatherSwizzle()`/`spvGatherCompareSwizzle()`.

Update the C API. In addition to supporting this new functionality, add
some compiler options that I added in previous changes, but for which I
neglected to update the C API.
2019-09-01 18:35:53 -05:00
..
16bit-constants.invalid.frag Update external repos. 2019-07-13 16:50:21 -05:00
argument-buffers.msl2.argument.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
array-lut-no-loop-variable.frag Only declare typed initializer list for non-array types. 2018-09-10 10:04:17 +02:00
array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag MSL: Add support for sampler Y'CbCr conversion. 2019-09-01 18:35:53 -05:00
array-of-texture-swizzle.msl2.swizzle.frag MSL: Add support for sampler Y'CbCr conversion. 2019-09-01 18:35:53 -05: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 CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
binary-func-unpack-pack-arguments.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
binary-unpack-pack-arguments.frag Regenerate MSL shaders to fix conflicts from merge. 2018-06-12 11:51:56 -04:00
bitcasting.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
buffer-read-write.frag Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
buffer-read-write.texture-buffer-native.msl21.frag MSL: Cast texture_buffer index to uint. 2019-04-23 12:46:48 +02:00
builtins.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
complex-expression-in-access-chain.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
composite-extract-forced-temporary.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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
control-dependent-in-branch.desktop.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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 CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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
fp16-packing.frag MSL: Handle interpolation qualifiers. 2018-09-05 12:02:07 -05: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 CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
gather-dref.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
in_block.frag MSL: Support global I/O block and struct Input/Output usage. 2018-09-13 16:04:24 +02:00
in_mat.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02: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 MSL: Support global I/O block and struct Input/Output usage. 2018-09-13 16:04:24 +02:00
interpolation-qualifiers.frag MSL: Handle interpolation qualifiers. 2018-09-05 12:02:07 -05:00
lut-promotion.frag Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
mix.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
mrt-array.frag Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
nonuniform-qualifier.msl2.frag Update external repos. 2019-07-13 16:50:21 -05: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 MSL: Fix declaration of unused input variables. 2019-05-31 13:23:34 +02:00
pls.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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 MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02: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 Use a hook to emit a local for the sample position. 2018-09-17 11:51:09 -05:00
sample-position.frag Use a hook to emit a local for the sample position. 2018-09-17 11:51:09 -05:00
sampler-1d-lod.frag MSL: Handle interpolation qualifiers. 2018-09-05 12:02:07 -05:00
sampler-compare-cascade-gradient.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
sampler-compare-cascade-gradient.ios.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
sampler-image-arrays.msl2.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
sampler-ms.frag Update test files 2018-01-29 06:40:45 -08:00
sampler.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
scalar-refract-reflect.frag Don't use scalar dot(). 2019-07-03 14:32:06 +02:00
separate-image-sampler-argument.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
shader-arithmetic-8bit.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
shadow-compare-global-alias.invalid.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
spec-constant-block-size.frag Update tests. 2018-11-01 11:23:48 +01:00
spec-constant-ternary.frag Update to latest glslang/SPIRV-Tools. 2019-01-30 13:41:57 +01: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 CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
texel-fetch-offset.frag Need to make sure the fetch expression is uint. 2018-08-07 16:02:17 +02:00
texture-multisample-array.msl21.frag MSL: Support texture2d_ms_array. 2018-09-03 11:02:31 +02:00
texture-proj-shadow.frag MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
ubo_layout.frag MSL: Support storing to row-major column. 2019-07-22 11:13:44 +02:00
unary-enclose.frag CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04: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