Commit Graph

24 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
15d29f00e2 Add test for SPIR-V 1.6 Volatile HelperInvocation. 2022-03-04 11:19:33 +01:00
Hans-Kristian Arntzen
31be74a853 Add relax_nan_checks options.
Makes codegen from typical D3D emulation SPIR-V more readable.
Also makes cross compilation with NotEqual more sensible.
It's very rare to actually need the strict NaN-checks in practice.

Also, glslang now emits UnordNotEqual by default it seems, so give up
trying to assume OrdNotEqual. Harmonize for UnordNotEqual as the sane
default.
2022-03-03 14:50:56 +01:00
Hans-Kristian Arntzen
71b83a18f4 MSL: Add test for scalar access chain pull interpolant. 2021-07-13 12:25:18 +02:00
Hans-Kristian Arntzen
165dbff228 Handle odd type for textureGather component. 2021-06-03 11:37:45 +02:00
Hans-Kristian Arntzen
893a011299 MSL: Fix various bugs with framebuffer fetch on macOS and argument buffers.
Introduce a helper to make it clearer if a resource can be
considered for argument buffers or not.
2021-01-08 10:19:18 +01:00
Hans-Kristian Arntzen
3136e34215 MSL: Always use input_attachment_index for framebuffer fetch binding.
--msl-decoration-binding would end up overriding the input attachment
index to binding which is very unexpected and broken.
2021-01-08 10:17:42 +01:00
Hans-Kristian Arntzen
a11c4780d0 GLSL: Emit nonuniformEXT in correct place for late-combined samplers.
Need to emit nonuniformEXT(sampler2D()) since constructor expressions in
Vulkan GLSL do not propgate the nonuniform qualifier.
2020-12-07 13:00:15 +01:00
Chip Davis
68908355a9 MSL: Expand subgroup support.
Add support for declaring a fixed subgroup size. Metal, like Vulkan with
`VK_EXT_subgroup_size_control`, allows the thread execution width to
vary depending on factors such as register usage. Unfortunately, this
breaks several tests that depend on the subgroup size being what the
device says it is. So we'll fix the subgroup size at the size the device
declares. The extra invocations in the subgroup will appear to be
inactive. Because of this, the ballot mask builtins are now ANDed with
the active subgroup mask.

Add support for emulating a subgroup of size 1. This is intended to be
used by Vulkan Portability implementations (e.g. MoltenVK) when the
hardware/software combo provides insufficient support for subgroups.
Luckily for us, Vulkan 1.1 only requires that the subgroup size be at
least 1.

Add support for quadgroup and SIMD-group functions which were added to
iOS in Metal 2.2 and 2.3. This will allow clients to take advantage of
expanded quadgroup and SIMD-group support in recent Metal versions and
on recent Apple GPUs (families 6 and 7).

Gut emulation of subgroup builtins in fragment shaders. It turns out
codegen for the SIMD-group functions in fragment wasn't implemented for
AMD on Mojave; it's a safe bet that it wasn't implemented for the other
drivers either. Subgroup support in fragment shaders now requires Metal
2.2.
2020-11-20 15:55:49 -06:00
Hans-Kristian Arntzen
db13762297 MSL: Fix regression in image gather handling.
It was not always possible to get backing variable for a late-combined
image sampler.
2020-11-06 16:21:30 +01:00
Chip Davis
c20d5945a2 MSL: Allow framebuffer fetch on Mac in MSL 2.3.
Another Apple GPU feature that will now be supported on Apple Silicon
Macs.
2020-10-29 10:50:59 -05:00
Hans-Kristian Arntzen
f65f259ab7 MSL: Do not use component::x gather for depth2d textures. 2020-10-26 10:18:17 +01:00
Chip Davis
1264e2705e MSL: Cast broadcast booleans to ushort.
Metal doesn't support broadcasting or shuffling boolean values, but we
can work around that by casting it to `ushort`, then casting it back to
`bool`. I used `ushort` instead of `uint` because 16-bit values give
better throughput on Apple GPUs.
2020-10-23 21:55:46 -05:00
Chip Davis
781367d083 MSL: Support vectors with OpGroupNonUniformAllEqual.
This was not tested here in SPIRV-Cross. Predictably, it broke when I
tried it in the CTS.
2020-10-23 21:55:46 -05:00
Hans-Kristian Arntzen
e1600d4df8 MSL: Use input attachment index directly for resource index fallback. 2020-07-06 09:49:46 +02:00
Hans-Kristian Arntzen
0ebb88cc39 MSL: Redirect member indices when buffer has been sorted by Offset.
If a buffer rewrites its Offsets, all member references to that struct
are invalidated, and must be redirected, do so in to_member_reference,
but there might be other places where this is needed. Fix as required.
SPIR-V code relying on this is somewhat questionable, but seems to be
in-spec.
2020-04-30 11:48:53 +02:00
Hans-Kristian Arntzen
6ef47d6657 MSL: Fix case where subpassInput is passed to leaf functions. 2020-04-27 11:29:21 +02:00
Hans-Kristian Arntzen
3cb6aeb480 MSL: Fix access chain for deep struct hierarchy on array of buffers. 2020-03-31 14:17:29 +02:00
Hans-Kristian Arntzen
b8905bbd95 Add support for forcefully zero-initialized variables.
Useful to better support certain platforms which require all variables
to be initialized to something.
2020-03-26 13:38:27 +01:00
Hans-Kristian Arntzen
c3bd136df1 MSL: Add support for force-activating IAB resources.
Important for ABI compatibility on MSL in certain cases.
2020-01-16 11:12:06 +01:00
Hans-Kristian Arntzen
d4ca91f6c2 Move .invalid. test shaders to the more appropriate subfolders. 2019-11-06 10:40:37 +01:00
Hans-Kristian Arntzen
63a770ed5c Add test shader for simple case of interlocked callstack. 2019-09-04 11:56:19 +02:00
Chip Davis
4302c5abfb Pass the swizzle constants as a buffer.
It'll be useful to have an "auxiliary buffer" for other builtins--e.g.
`DrawIndex` (which should be easier to implement now), or `ViewIndex`
when someone gets around to implementing multiview.

Pass this buffer to leaf functions as well.

Test that we handle this for integer textures as well.
2018-09-22 19:36:11 -05:00
Chip Davis
2583321657 MSL: Add an option to insert texture swizzles into generated shaders.
It's intended to be used with MoltenVK to support arbitrary
`VkComponentMapping` settings. The idea is that MoltenVK will pass a
buffer (which it set to some buffer index that isn't being used)
containing packed versions of the `VkComponentMapping` struct, one for
each sampled image.

Yes, this is horribly ugly. It is unfortunately necessary. Much of the
ugliness is to support swizzling gather operations, where we need to
alter the component that the gather operates on--something complicated
by the `gather()` method requiring the passed-in component to be a
constant expression. It doesn't even support swizzling gathers on depth
textures, though I could add that if it turns out we need it.
2018-09-19 22:32:24 -05:00
Hans-Kristian Arntzen
e7bf8d2f48 Refactor out noopt shaders to their own folders.
Makes maintenance easier with less clutter.
2018-03-13 10:39:49 +01:00