SPIRV-Cross/reference/shaders-msl/comp
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
..
access-private-workgroup-in-function.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
argument-buffers-discrete.msl2.argument.discrete.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
argument-buffers-image-load-store.msl2.argument.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
array-length.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
array-length.msl2.argument.discrete.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
atomic.comp MSL: Handle coherent, volatile, and restrict. 2019-07-11 10:22:30 -05:00
barriers.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
basic.comp MSL: Handle coherent, volatile, and restrict. 2019-07-11 10:22:30 -05:00
basic.dispatchbase.comp MSL: Adjust BuiltInWorkgroupId for vkCmdDispatchBase(). 2019-07-24 08:56:15 -05:00
basic.dispatchbase.msl11.comp MSL: Adjust BuiltInWorkgroupId for vkCmdDispatchBase(). 2019-07-24 08:56:15 -05:00
bitcast-16bit-1.invalid.comp Always value-cast FP16 constants instead of using literals. 2019-02-20 12:30:01 +01:00
bitcast-16bit-2.invalid.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
builtins.comp MSL: Declare gl_WorkGroupSize constant with [[maybe_unused]]. 2019-03-28 10:54:18 +01:00
cfg-preserve-parameter.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
coherent-block.comp MSL: Handle coherent, volatile, and restrict. 2019-07-11 10:22:30 -05:00
coherent-image.comp MSL: Handle coherent, volatile, and restrict. 2019-07-11 10:22:30 -05:00
complex-type-alias.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
composite-array-initialization.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
composite-construct.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
copy-array-of-arrays.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
culling.comp MSL: Handle coherent, volatile, and restrict. 2019-07-11 10:22:30 -05:00
defer-parens.comp Enhance MSL testing and add numerous MSL test cases. 2017-01-30 22:55:21 -05:00
dowhile.comp Declare read-only SSBOs as const device in MSL. 2018-05-25 10:14:05 +02:00
force-recompile-hooks.swizzle.comp MSL: Add support for sampler Y'CbCr conversion. 2019-09-01 18:35:53 -05:00
functions.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
global-invocation-id-writable-ssbo-in-function.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
global-invocation-id.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
image-cube-array-load-store.comp Fix image load/store on cube arrays in MSL. 2018-05-25 12:43:25 +02:00
image.comp Update test files 2018-01-29 06:40:45 -08:00
insert.comp Enhancements to MSL compute and entry point naming. 2017-11-05 21:34:42 -05:00
int64.invalid.msl22.comp MSL: Error out on int64_t/uint64_t buffer members. 2019-06-19 10:14:46 +02:00
inverse.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
local-invocation-id.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
local-invocation-index.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
mat3.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
mod.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
modf.comp Declare read-only SSBOs as const device in MSL. 2018-05-25 10:14:05 +02:00
outer-product.comp MSL/HLSL: Support OpOuterProduct. 2019-07-01 10:57:27 +02:00
packing-test-1.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
packing-test-2.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
read-write-only.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
rmw-matrix.comp Do not use RMW rewrite for matrices. 2018-05-04 10:35:56 +02:00
rmw-opt.comp Enhancements to MSL compute and entry point naming. 2017-11-05 21:34:42 -05:00
scalar-std450-distance-length-normalize.comp Deal with scalar input values for distance/length/normalize. 2019-06-28 11:20:14 +02:00
shared-array-of-arrays.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
shared.comp MSL: Declare gl_WorkGroupSize constant with [[maybe_unused]]. 2019-03-28 10:54:18 +01:00
spec-constant-op-member-array.comp Update to latest glslang/SPIRV-Tools. 2019-01-30 13:41:57 +01:00
spec-constant-work-group-size.comp MSL: Declare gl_WorkGroupSize constant with [[maybe_unused]]. 2019-03-28 10:54:18 +01:00
storage-buffer-std140-vector-array.comp MSL: Fix struct declaration order with complex type aliases. 2019-05-23 14:54:04 +02:00
struct-layout.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
struct-nested.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
struct-packing.comp Simplify row-major matrix/vector multiplies. 2019-07-23 10:56:57 +02:00
torture-loop.comp Declare read-only SSBOs as const device in MSL. 2018-05-25 10:14:05 +02:00
type-alias.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00
udiv.comp MSL: Rewrite how resource indices are fallback-assigned. 2019-06-21 12:54:08 +02:00
writable-ssbo.comp Update tests to account for all non-entry-point functions being inlined 2019-08-30 09:39:06 +12:00